Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5327 > unrolled thread
| Started by | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| First post | 2011-10-03 08:23 +0000 |
| Last post | 2011-10-03 08:23 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: count zeros in a number DrMajorBob <btreat1@austin.rr.com> - 2011-10-03 08:23 +0000
| From | DrMajorBob <btreat1@austin.rr.com> |
|---|---|
| Date | 2011-10-03 08:23 +0000 |
| Subject | Re: count zeros in a number |
| Message-ID | <j6bret$8l0$1@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 top | Article view | comp.soft-sys.math.mathematica
csiph-web