A122840 a(n) is the number of 0's at the end of n when n is written in base 10.
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0
Offset: 1
Examples
a(160) = 1 because there is 1 zero at the end of 160 when 160 is written in base 10.
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
- S. Ikeda and K. Matsuoka, On transcendental numbers generated by certain integer sequences, Siauliai Math. Semin., 8 (16) 2013, 63-69.
Crossrefs
Programs
-
Haskell
a122840 n = if n < 10 then 0 ^ n else 0 ^ d * (a122840 n' + 1) where (n', d) = divMod n 10 -- Reinhard Zumkeller, Mar 09 2013
-
Mathematica
a[n_] := IntegerExponent[n, 10]; Array[a, 100] (* Amiram Eldar, Mar 10 2021 *)
-
PARI
a(n)=valuation(n,10) \\ Charles R Greathouse IV, Feb 26 2014
-
Python
def a(n): return len(str(n)) - len(str(int(str(n)[::-1]))) # Indranil Ghosh, Jun 09 2017
-
Python
def A122840(n): return len(s:=str(n))-len(s.rstrip('0')) # Chai Wah Wu, Jul 06 2022
-
Python
A122840 = lambda n: sympy.multiplicity(10,n) # M. F. Hasler, Apr 05 2024
Formula
a(n) = A160094(n) - 1.
From Hieronymus Fischer, Jun 08 2012: (Start)
With m = floor(log_10(n)), frac(x) = x-floor(x):
a(n) = Sum_{j=1..m} (1 - ceiling(frac(n/10^j))).
a(n) = m + Sum_{j=1..m} (floor(-frac(n/10^j))).
G.f.: g(x) = Sum_{j>0} x^10^j/(1-x^10^j). (End)
Comments