%I M3808 N1557 #98 Apr 14 2022 03:11:50
%S 5,11,17,23,29,30,36,42,48,54,60,61,67,73,79,85,91,92,98,104,110,116,
%T 122,123,129,135,141,147,153,154,155,161,167,173,179,185,186,192,198,
%U 204,210,216,217,223,229,235,241,247,248,254,260,266,272,278,279,285
%N n! never ends in this many 0's.
%C This sequence also holds for bases 5, 15, 20, 30, 40, 60 and 120. These bases (together with 10) are the proper divisors of 5! that are divisible by 5. - _Carl R. White_, Jan 21 2008
%C The g.f. conjectured by _Simon Plouffe_ in 1992 dissertation is not correct; the first discrepancy is a(31) = 155, his g.f. gives 160. In fact, the g.f. for this sequence is not rational; the first differences are bounded but not periodic. - _Franklin T. Adams-Watters_, Jul 03 2009
%C a(n+1) - a(n) = 1 or 6: Let k be the smallest number such that (5*k)! ends in at least a(n)+1 zeros, then k is a multiple of 5, otherwise (5*(k-1))! would end in at least a(n) zeros, either contradicting with the minimality of k or with the fact that a(n) is a term. If (5*k)! ends in exactly a(n)+1 zeros, then the next term after a(n) is a(n)+6, otherwise it is a(n)+1. - _Jianing Song_, Apr 13 2022
%D N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 42
%H Michael S. Branicky, <a href="/A000966/b000966.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from T. D. Noe)
%H Gerald Hillier, <a href="http://www.hpmuseum.org/forum/thread-9190.html">Program for HP 49G calculator</a>, MoHPC: The Museum of HP Calculators, Sep 29 2017.
%H L. Moser, <a href="http://www.jstor.org/stable/3029408">Problem 158</a>, Math. Mag., 27 (1953), 54-55. Solution by C. W. Trigg.
%H L. Moser and C. W. Trigg, <a href="/A000966/a000966.pdf">Problem 158</a> (annotated and scanned copy)
%H A. M. Oller-Marcen and J. Maria Grau, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL14/Oller/oller3.html">On the Base-b Expansion of the Number of Trailing Zeros of b^k!</a>, J. Int. Seq. 14 (2011) 11.6.8.
%H Simon Plouffe, <a href="https://arxiv.org/abs/0911.4975">Approximations de séries génératrices et quelques conjectures</a>, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
%H Simon Plouffe, <a href="/A000051/a000051_2.pdf">1031 Generating Functions</a>, Appendix to Thesis, Montreal, 1992.
%H N. J. A. Sloane, <a href="/transforms.txt">Transforms</a>
%H <a href="/index/Fa#factorial">Index entries for sequences related to factorial numbers</a>
%F The simplest way to obtain this sequence is by constructing a power series A(x) = Sum_{k >= 1} x^a(k) whose exponents give the terms of the sequence. Define e(n) = (5^n-1)/4, f(n) = (1-x^(e(n)-1))/(1-x^e(n-1)), t(n) = x^(e(n)-6).
%F Now use the recurrence A[2] = 1 and for n >= 3, A[n] = f(n)*A[n-1]+t(n); then A = limit_{n->infinity} x^5*A[n]. This follows easily from the explicit formula for A027868(n). Here is the beginning of A: x^5 + x^11 + x^17 + x^23 + x^29 + x^30 + x^36 + x^42 + x^48 + ... - _N. J. A. Sloane_, Feb 02 2007
%F Formula from C. W. Trigg (see the Moser reference): All terms can be described as follows: for k = 1, 2, 3, ..., the number 6k-1 + floor(k/5) + floor(k/5^2) + floor(k/5^3) + ... is a term together with A112765(k) preceding numbers. [corrected and simplified by _Gerald Hillier_ and _Andrey Zabolotskiy_, Sep 13 2017]
%e 17 is in the sequence because on passing from 74! to 75!, the number of end zeros jumps from 16 to 18, skipping 17.
%e More generally, we have:
%e n, n!
%e -----
%e 0, 1
%e 1, 1
%e 2, 2
%e 3, 6
%e 4, 24
%e 5, 120
%e 6, 720
%e 7, 5040
%e 8, 40320
%e 9, 362880
%e 10, 3628800
%e 11, 39916800
%e 12, 479001600
%e 13, 6227020800
%e 14, 87178291200
%e 15, 1307674368000
%e 16, 20922789888000
%e 17, 355687428096000
%e 18, 6402373705728000
%e 19, 121645100408832000
%e 20, 2432902008176640000
%e 21, 51090942171709440000
%e 22, 1124000727777607680000
%e 23, 25852016738884976640000
%e 24, 620448401733239439360000
%e 25, 15511210043330985984000000 <- jump from 4 to 6 trailing 0's, so 5 is a term
%e 26, 403291461126605635584000000
%e 27, 10888869450418352160768000000
%e 28, 304888344611713860501504000000
%e 29, 8841761993739701954543616000000
%e 30, 265252859812191058636308480000000
%e etc.
%p read(transforms); e:=n->(5^n-1)/4; f:=n->(1-x^(e(n)-1))/(1-x^e(n-1)); t:=n->x^(e(n)-6); A[2]:=1; for n from 3 to 8 do A[n]:=f(n)*A[n-1]+t(n); od: POWERS(series(x^5*A[8],x,5005),x,5005); # _N. J. A. Sloane_, Feb 02 2007
%t u=Union[FoldList[Plus,0,IntegerExponent[Range[1000],5]]]; Complement[Range[u[[ -1]]], u] (* _T. D. Noe_, Feb 02 2007 *)
%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}; nmz[n_]:=Module[{zs=zOF[Range[n]]},Complement[ Range[ Max[zs]],zs]]; nmz[2000] (* _Harvey P. Dale_, Mar 05 2017 *)
%o (PARI) valp(n,p)=my(s); while(n\=p, s+=n); s
%o is(n)=my(t=(4*n-1)\5*5+5, s=valp(t,5)-n); while(s<0, s+=valuation(t+=5, 5)); s>0 \\ _Charles R Greathouse IV_, Sep 22 2016
%o (Python)
%o from itertools import count, islice
%o def val(n, p):
%o e = 0
%o while n%p == 0: n //= p; e += 1
%o return e
%o def agen(): # generator of terms
%o fi, nz, z = 1, 0, 0
%o for i in count(1):
%o fi *= 2**val(i, 2) * 5**val(i, 5)
%o z = val(fi, 10)
%o for k in range(nz+1, nz+z): yield k
%o nz += z
%o fi //= 10**z
%o print(list(islice(agen(), 56))) # _Michael S. Branicky_, Apr 13 2022
%Y Cf. A000142, A027868, A080066 (first differences), A191610 (complement), A096346 (same for base 3), A055938 (same for base 2), A136767-A136774.
%K nonn,base,nice
%O 1,1
%A _N. J. A. Sloane_, _Robert G. Wilson v_
%E More terms from Mark Hudson (mrmarkhudson(AT)hotmail.com), Jan 24 2003
%E Corrected by _Sascha Kurz_, Jan 27 2003