       Re: count zeros in a number

• To: mathgroup at smc.vnet.net
• Subject: [mg121800] Re: count zeros in a number
• From: DrMajorBob <btreat1 at austin.rr.com>
• Date: Mon, 3 Oct 2011 04:21:11 -0400 (EDT)
• Delivered-to: l-mathgroup@mail-archive0.wolfram.com
• References: <201110020636.CAA28027@smc.vnet.net>
• Reply-to: drmajorbob at yahoo.com

```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 at 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:= Mod[24^24*55^55, 10^55]
> Mod[24^24*55^55, 10^56]
>
> Out= 0
> Out= 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 at yahoo.com

```

• Prev by Date: Re: count zeros in a number
• Next by Date: Solve - takes very long time
• Previous by thread: Re: count zeros in a number
• Next by thread: Re: count zeros in a number