Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: count zeros in a number

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121827] Re: count zeros in a number
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 4 Oct 2011 01:31:37 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j69104$rda$1@smc.vnet.net> <201110030822.EAA08807@smc.vnet.net>
  • Reply-to: drmajorbob at yahoo.com

But the answer is 55, not 62.

z = 24^24*55^55;
Length[Split[IntegerDigits[z]][[-1]]]

55

Bobby

On Mon, 03 Oct 2011 03:22:37 -0500, Dr. Wolfgang Hintze <weh at snafu.de>  
wrote:

>
> "dimitris" <dimmechan at yahoo.com> schrieb im Newsbeitrag
> news:j69104$rda$1 at smc.vnet.net...
>> 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
>>
> You can use the function
>
> f[z_]:=Length[Split[IntegerDigits[z]][[-1]]]
> z = 24^24*55^55;
> f[z]
> 62
>
> Wolfgang
>
>


-- 
DrMajorBob at yahoo.com



  • Prev by Date: 3d EPS export files huge on Mac OS X, not so much on PCs
  • Next by Date: Re: count zeros in a number
  • Previous by thread: Re: count zeros in a number
  • Next by thread: Re: count zeros in a number