Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #5340 > unrolled thread
| Started by | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| First post | 2011-10-03 08:27 +0000 |
| Last post | 2011-10-03 08:27 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.soft-sys.math.mathematica
Re: count zeros in a number Bill Rowe <readnews@sbcglobal.net> - 2011-10-03 08:27 +0000
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Date | 2011-10-03 08:27 +0000 |
| Subject | Re: count zeros in a number |
| Message-ID | <j6brkr$8mf$1@smc.vnet.net> |
On 10/2/11 at 2:36 AM, dimmechan@yahoo.com (dimitris) wrote: >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. Here are a couple of ways: In[10]:= Count[IntegerDigits[Mod[24^24*55^55, 10^56]], 0] Out[10]= 55 In[11]:= Length[Split[IntegerDigits[Mod[24^24*55^55, 10^56]]][[-1]]] Out[11]= 55 The first method assumes the only zeros are trailing zeros. The second does not make this assumption by does assume there are trailing zeros.
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web