|
[Date Index]
[Thread Index]
[Author Index]
Re: count zeros in a number
- To: mathgroup at smc.vnet.net
- Subject: [mg121820] Re: count zeros in a number
- From: Richard Fateman <fateman at cs.berkeley.edu>
- Date: Tue, 4 Oct 2011 01:30:21 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <201110020636.CAA28027@smc.vnet.net> <j6brvm$8om$1@smc.vnet.net>
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
Prev by Date:
Re: count zeros in a number
Next by Date:
simplification
Previous by thread:
Re: count zeros in a number
Next by thread:
Re: count zeros in a number
|