login
Possible number of trailing zeros in n!.
6

%I #34 Dec 06 2023 14:29:41

%S 0,1,2,3,4,6,7,8,9,10,12,13,14,15,16,18,19,20,21,22,24,25,26,27,28,31,

%T 32,33,34,35,37,38,39,40,41,43,44,45,46,47,49,50,51,52,53,55,56,57,58,

%U 59,62,63,64,65,66,68,69,70,71,72,74,75,76,77,78,80,81,82,83,84,86,87,88,89,90,93,94,95,96,97,99,100,101,102,103,105,106,107,108,109,111,112,113,114,115,117,118,119,120,121,124,125,126,127,128,130,131,132,133,134,136

%N Possible number of trailing zeros in n!.

%C Equivalently, possible values of 10-adic valuation of n!. - _Joerg Arndt_, Sep 21 2020

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

%F a(n) ~ 5*n/4. - _Vaclav Kotesovec_, Sep 21 2020

%F G.f.: 1/(1-x) * Sum_{k>=0} x^(5^k)/(1-x^5^k). - _Joerg Arndt_, Sep 21 2020

%t zOF[n_Integer?Positive]:=Module[{maxpow=0},While[5^maxpow<=n,maxpow++];Plus@@Table[ Quotient[n,5^i],{i,maxpow-1}]]; Attributes[zOF]={Listable}; zOF[Range[1000]]//Union (* _Harvey P. Dale_, Dec 06 2023 *)

%o (Haskell)

%o a191610 1 = 0

%o a191610 n = sum $ takeWhile (> 0) $ map ((n - 1) `div`) a000351_list

%o -- _Reinhard Zumkeller_, Oct 31 2012

%o (Python)

%o # requires Python 3.2 and higher

%o from itertools import accumulate

%o from sympy import multiplicity

%o A191610 = [0]+list(accumulate(multiplicity(5,n) for n in range(5,10**3,5)))

%o # _Chai Wah Wu_, Sep 05 2014

%Y Cf. A027868, A000351, A055457 (first differences).

%Y Complement of A000966.

%K nonn

%O 1,3

%A _José María Grau Ribas_, Jun 09 2011