A000966 n! never ends in this many 0's.
5, 11, 17, 23, 29, 30, 36, 42, 48, 54, 60, 61, 67, 73, 79, 85, 91, 92, 98, 104, 110, 116, 122, 123, 129, 135, 141, 147, 153, 154, 155, 161, 167, 173, 179, 185, 186, 192, 198, 204, 210, 216, 217, 223, 229, 235, 241, 247, 248, 254, 260, 266, 272, 278, 279, 285
Offset: 1
Examples
17 is in the sequence because on passing from 74! to 75!, the number of end zeros jumps from 16 to 18, skipping 17. More generally, we have: n, n! ----- 0, 1 1, 1 2, 2 3, 6 4, 24 5, 120 6, 720 7, 5040 8, 40320 9, 362880 10, 3628800 11, 39916800 12, 479001600 13, 6227020800 14, 87178291200 15, 1307674368000 16, 20922789888000 17, 355687428096000 18, 6402373705728000 19, 121645100408832000 20, 2432902008176640000 21, 51090942171709440000 22, 1124000727777607680000 23, 25852016738884976640000 24, 620448401733239439360000 25, 15511210043330985984000000 <- jump from 4 to 6 trailing 0's, so 5 is a term 26, 403291461126605635584000000 27, 10888869450418352160768000000 28, 304888344611713860501504000000 29, 8841761993739701954543616000000 30, 265252859812191058636308480000000 ...
References
- N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
- David Wells, The Penguin Dictionary of Curious and Interesting Numbers (Rev. ed. 1997), p. 42
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1000 from T. D. Noe)
- Gerald Hillier, Program for HP 49G calculator, MoHPC: The Museum of HP Calculators, Sep 29 2017.
- L. Moser, Problem 158, Math. Mag., 27 (1953), 54-55. Solution by C. W. Trigg.
- L. Moser and C. W. Trigg, Problem 158 (annotated and scanned copy)
- A. M. Oller-Marcen and J. Maria Grau, On the Base-b Expansion of the Number of Trailing Zeros of b^k!, J. Int. Seq. 14 (2011) 11.6.8.
- Simon Plouffe, Approximations de séries génératrices et quelques conjectures, Dissertation, Université du Québec à Montréal, 1992; arXiv:0911.4975 [math.NT], 2009.
- Simon Plouffe, 1031 Generating Functions, Appendix to Thesis, Montreal, 1992.
- N. J. A. Sloane, Transforms
- Index entries for sequences related to factorial numbers
Crossrefs
Programs
-
Maple
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
-
Mathematica
u=Union@Accumulate@IntegerExponent[Range[1000],5]; Complement[Range[Last@u], u] (* T. D. Noe, Feb 02 2007, and Paul C Abbott, May 12 2025 *) 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 *) a[1]=5; d[n_]:=a[n+1]=a[n]+1; a[n_]:=a[n]=a[n-1]+6; (n|->d[a[n]])/@Range[40];a/@Range[a[40]+ 1] (* Paul C Abbott, May 12 2025 *)
-
PARI
valp(n,p)=my(s); while(n\=p, s+=n); s 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
-
Python
from itertools import count, islice def val(n, p): e = 0 while n%p == 0: n //= p; e += 1 return e def agen(): # generator of terms fi, nz, z = 1, 0, 0 for i in count(1): fi *= 2**val(i, 2) * 5**val(i, 5) z = val(fi, 10) for k in range(nz+1, nz+z): yield k nz += z fi //= 10**z print(list(islice(agen(), 56))) # Michael S. Branicky, Apr 13 2022
Formula
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).
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
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]
Extensions
More terms from Mark Hudson (mrmarkhudson(AT)hotmail.com), Jan 24 2003
Corrected by Sascha Kurz, Jan 27 2003
Comments