login
a(n) is the number of 0's at the end of n when n is written in base 10.
47

%I #58 Apr 08 2024 18:54:21

%S 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,

%T 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,

%U 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

%N a(n) is the number of 0's at the end of n when n is written in base 10.

%C Greatest k such that 10^k divides n.

%C a(n) = the number of digits in n - A160093(n).

%C a(A005117(n)) <= 1. - _Reinhard Zumkeller_, Mar 30 2010

%C See A054899 for the partial sums. - _Hieronymus Fischer_, Jun 08 2012

%C From _Amiram Eldar_, Mar 10 2021: (Start)

%C The asymptotic density of the occurrences of k is 9/10^(k+1).

%C The asymptotic mean of this sequence is 1/9. (End)

%H Reinhard Zumkeller, <a href="/A122840/b122840.txt">Table of n, a(n) for n = 1..10000</a>

%H S. Ikeda and K. Matsuoka, <a href="http://siauliaims.su.lt/pdfai/2013/Iked-Mats-2013.pdf">On transcendental numbers generated by certain integer sequences</a>, Siauliai Math. Semin., 8 (16) 2013, 63-69.

%F a(n) = A160094(n) - 1.

%F From _Hieronymus Fischer_, Jun 08 2012: (Start)

%F With m = floor(log_10(n)), frac(x) = x-floor(x):

%F a(n) = Sum_{j=1..m} (1 - ceiling(frac(n/10^j))).

%F a(n) = m + Sum_{j=1..m} (floor(-frac(n/10^j))).

%F a(n) = A054899(n) - A054899(n-1).

%F G.f.: g(x) = Sum_{j>0} x^10^j/(1-x^10^j). (End)

%F a(n) = min(A007814(n), A112765(n)). - _Jianing Song_, Jul 23 2022

%e a(160) = 1 because there is 1 zero at the end of 160 when 160 is written in base 10.

%t a[n_] := IntegerExponent[n, 10]; Array[a, 100] (* _Amiram Eldar_, Mar 10 2021 *)

%o (Haskell)

%o a122840 n = if n < 10 then 0 ^ n else 0 ^ d * (a122840 n' + 1)

%o where (n', d) = divMod n 10

%o -- _Reinhard Zumkeller_, Mar 09 2013

%o (PARI) a(n)=valuation(n,10) \\ _Charles R Greathouse IV_, Feb 26 2014

%o (Python)

%o def a(n): return len(str(n)) - len(str(int(str(n)[::-1]))) # _Indranil Ghosh_, Jun 09 2017

%o (Python)

%o def A122840(n): return len(s:=str(n))-len(s.rstrip('0')) # _Chai Wah Wu_, Jul 06 2022

%o (Python)

%o A122840 = lambda n: sympy.multiplicity(10,n) # _M. F. Hasler_, Apr 05 2024

%Y A007814 is the base 2 equivalent of this sequence.

%Y Cf. A160094, A160093, A001511, A070940, A122841, A027868, A054899, A196563, A196564, A004151, A112765.

%K nonn,base,easy

%O 1,100

%A _Reinhard Zumkeller_, Sep 13 2006