Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5327
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: count zeros in a number |
| Date | 2011-10-03 08:23 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j6bret$8l0$1@smc.vnet.net> (permalink) |
| References | <201110020636.CAA28027@smc.vnet.net> |
n = 24^24*55^55
6998705566601499878519159087153235987310926417579055430641039765858300\
72320000000000000000000000000000000000000000000000000000000
IntegerDigits[n] /. {__, zeroes : 0 ..} :> Length@{zeroes}
55
The more complicated version:
IntegerDigits[n] /. {__, zeroes : Longest[0 ..]} :> Length@{zeroes}
55
isn't necessary, because __ is taken to mean Shortest[__] by default.
Bobby
On Sun, 02 Oct 2011 01:36:47 -0500, dimitris <dimmechan@yahoo.com> wrote:
> Hello.
>
> Consider e.g. the number 24^24*55^55.
> This number ends with exactly 55 zeros as the following demonstrate
>
> In[201]:= Mod[24^24*55^55, 10^55]
> Mod[24^24*55^55, 10^56]
>
> Out[201]= 0
> Out[202]= 20000000000000000000000000000000000000000000000000000000
>
>
> What I want now is a way to count the zeros that a number ends without
> knowing in advance this number of zeros like in the above example.
>
> Thanks in advance.
> Dimitris
>
--
DrMajorBob@yahoo.com
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-03 08:23 +0000
csiph-web