Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5361

Re: count zeros in a number

From Richard Fateman <fateman@cs.berkeley.edu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: count zeros in a number
Date 2011-10-04 05:31 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j6e5nq$k8m$1@smc.vnet.net> (permalink)
References <201110020636.CAA28027@smc.vnet.net> <j6brvm$8om$1@smc.vnet.net>

Show all headers | View raw


How disappointing that the usual crew did not come up with a way of 
solving this simply, arithmetically, like this:

(n = 0; While[GCD[24^24*55^55, 10^n] == 10^n, n++]; n - 1)

or

(n = 0; x = 24^24*55^55;
  While[Mod[x, 10] == 0, (x = x/10; n++)  ]; n)

or any of the numerous minor variants....

but instead resorted to conversion to strings or factoring.

The arithmentic methods may be slower since they rely on the slow 
implementation of looping constructs in Mathematica, but they
don't require any of the more esoteric features like
Exponents, Split, IntegerDigits, ...

RJF

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Re: count zeros in a number "Harvey P. Dale" <hpd1@nyu.edu> - 2011-10-03 08:32 +0000
  Re: count zeros in a number Richard Fateman <fateman@cs.berkeley.edu> - 2011-10-04 05:31 +0000
  Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-05 08:05 +0000
  Re: count zeros in a number Richard Fateman <fateman@eecs.berkeley.edu> - 2011-10-05 08:08 +0000
  Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-05 08:09 +0000
  Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-05 08:11 +0000
  Re: count zeros in a number Richard Fateman <fateman@eecs.berkeley.edu> - 2011-10-05 08:12 +0000
  Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-05 08:13 +0000

csiph-web