cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-7 of 7 results.

A027868 Number of trailing zeros in n!; highest power of 5 dividing n!.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 18, 18, 18, 18, 18, 19
Offset: 0

Views

Author

Keywords

Comments

Also the highest power of 10 dividing n! (different from A054899). - Hieronymus Fischer, Jun 18 2007
Alternatively, a(n) equals the expansion of the base-5 representation A007091(n) of n (i.e., where successive positions from right to left stand for 5^n or A000351(n)) under a scale of notation whose successive positions from right to left stand for (5^n - 1)/4 or A003463(n); for instance, n = 7392 has base-5 expression 2*5^5 + 1*5^4 + 4*5^3 + 0*5^2 + 3*5^1 + 2*5^0, so that a(7392) = 2*781 + 1*156 + 4*31 + 0*6 + 3*1 + 2*0 = 1845. - Lekraj Beedassy, Nov 03 2010
Partial sums of A112765. - Hieronymus Fischer, Jun 06 2012
Also the number of trailing zeros in A000165(n) = (2*n)!!. - Stefano Spezia, Aug 18 2024

Examples

			a(100)  = 24.
a(10^3) = 249.
a(10^4) = 2499.
a(10^5) = 24999.
a(10^6) = 249998.
a(10^7) = 2499999.
a(10^8) = 24999999.
a(10^9) = 249999998.
a(10^n) = 10^n/4 - 3 for 10 <= n <= 15 except for a(10^14) = 10^14/4 - 2. - _M. F. Hasler_, Dec 27 2019
		

References

  • M. Gardner, "Factorial Oddities." Ch. 4 in Mathematical Magic Show: More Puzzles, Games, Diversions, Illusions and Other Mathematical Sleight-of-Mind from Scientific American. New York: Vintage, 1978, pp. 50-65.

Crossrefs

See A000966 for the missing numbers. See A011371 and A054861 for analogs involving powers of 2 and 3.
Cf. also A000142, A004154.

Programs

  • Haskell
    a027868 n = sum $ takeWhile (> 0) $ map (n `div`) $ tail a000351_list
    -- Reinhard Zumkeller, Oct 31 2012
    
  • Magma
    [Valuation(Factorial(n), 5): n in [0..80]]; // Bruno Berselli, Oct 11 2021
  • Maple
    0, seq(add(floor(n/5^i),i=1..floor(log[5](n))), n=1..100); # Robert Israel, Nov 13 2014
  • Mathematica
    Table[t = 0; p = 5; While[s = Floor[n/p]; t = t + s; s > 0, p *= 5]; t, {n, 0, 100} ]
    Table[ IntegerExponent[n!], {n, 0, 80}] (* Robert G. Wilson v *)
    zOF[n_Integer?Positive]:=Module[{maxpow=0},While[5^maxpow<=n,maxpow++];Plus@@Table[Quotient[n,5^i],{i,maxpow-1}]]; Attributes[zOF]={Listable}; Join[{0},zOF[ Range[100]]] (* Harvey P. Dale, Apr 11 2022 *)
  • PARI
    a(n)={my(s);while(n\=5,s+=n);s} \\ Charles R Greathouse IV, Nov 08 2012, edited by M. F. Hasler, Dec 27 2019
    
  • PARI
    a(n)=valuation(n!,5) \\ Charles R Greathouse IV, Nov 08 2012
    
  • PARI
    apply( A027868(n)=(n-sumdigits(n,5))\4, [0..99]) \\ M. F. Hasler, Dec 27 2019
    
  • Python
    from sympy import multiplicity
    A027868, p5 = [0,0,0,0,0], 0
    for n in range(5,10**3,5):
        p5 += multiplicity(5,n)
        A027868.extend([p5]*5) # Chai Wah Wu, Sep 05 2014
    
  • Python
    def A027868(n): return 0 if n<5 else n//5 + A027868(n//5) # David Radcliffe, Jun 26 2016
    
  • Python
    from sympy.ntheory.factor_ import digits
    def A027868(n): return n-sum(digits(n,5)[1:])>>2 # Chai Wah Wu, Oct 18 2024
    

Formula

a(n) = Sum_{i>=1} floor(n/5^i).
a(n) = (n - A053824(n))/4.
From Hieronymus Fischer, Jun 25 2007 and Aug 13 2007, edited by M. F. Hasler, Dec 27 2019: (Start)
G.f.: g(x) = Sum_{k>0} x^(5^k)/(1-x^(5^k))/(1-x).
a(n) = Sum_{k=5..n} Sum_{j|k, j>=5} (floor(log_5(j)) - floor(log_5(j-1))).
G.f.: g(x) = L[b(k)](x)/(1-x) where L[b(k)](x) = Sum_{k>=0} b(k)*x^k/(1-x^k) is a Lambert series with b(k) = 1, if k>1 is a power of 5, else b(k) = 0.
G.f.: g(x) = Sum_{k>0} c(k)*x^k/(1-x), where c(k) = Sum_{j>1, j|k} floor(log_5(j)) - floor(log_5(j - 1)).
Recurrence:
a(n) = floor(n/5) + a(floor(n/5));
a(5*n) = n + a(n);
a(n*5^m) = n*(5^m-1)/4 + a(n).
a(k*5^m) = k*(5^m-1)/4, for 0 <= k < 5, m >= 0.
Asymptotic behavior:
a(n) = n/4 + O(log(n)),
a(n+1) - a(n) = O(log(n)), which follows from the inequalities below.
a(n) <= (n-1)/4; equality holds for powers of 5.
a(n) >= n/4 - 1 - floor(log_5(n)); equality holds for n = 5^m-1, m > 0.
lim inf (n/4 - a(n)) = 1/4, for n -> oo.
lim sup (n/4 - log_5(n) - a(n)) = 0, for n -> oo.
lim sup (a(n+1) - a(n) - log_5(n)) = 0, for n -> oo.
(End)
a(n) <= A027869(n). - Reinhard Zumkeller, Jan 27 2008
10^a(n) = A000142(n) / A004154(n). - Reinhard Zumkeller, Nov 24 2012
a(n) = Sum_{k=1..floor(n/2)} floor(log_5(n/k)). - Ammar Khatab, Feb 01 2025

Extensions

Examples added by Hieronymus Fischer, Jun 06 2012

A027879 a(n) = Product_{i=1..n} (11^i - 1).

Original entry on oeis.org

1, 10, 1200, 1596000, 23365440000, 3763004112000000, 6666387564654720000000, 129909027758312519942400000000, 27847153692160782464830528512000000000, 65662131721505488121539650946349537280000000000
Offset: 0

Views

Author

Keywords

Comments

It appears that the number of trailing zeros in a(n) is A191610(n). - Robert Israel, Nov 24 2015

Crossrefs

Cf. A005329 (q=2), A027871 (q=3), A027637 (q=4), A027872 (q=5), A027873 (q=6), A027875 (q=7), A027876 (q=8), A027877 (q=9), A027878 (q=10), A027880 (q=12).

Programs

  • Magma
    [1] cat [&*[11^k-1: k in [1..n]]: n in [1..11]]; // Vincenzo Librandi, Dec 24 2015
  • Maple
    seq(mul(11^i-1,i=1..n),n=0..20; # Robert Israel, Nov 24 2015
  • Mathematica
    FoldList[Times,1,11^Range[10]-1] (* Harvey P. Dale, Aug 13 2013 *)
    Abs@QPochhammer[11, 11, Range[0, 40]] (* G. C. Greubel, Nov 24 2015 *)
  • PARI
    a(n)=prod(i=1,n,11^i-1) \\ Anders Hellström, Nov 21 2015
    

Formula

10^n|a(n) for n>=0; 12*(10)^(n)|a(n) n>=2. - G. C. Greubel, Nov 21 2015
a(n) ~ c * 11^(n*(n+1)/2), where c = Product_{k>=1} (1-1/11^k) = 0.900832706809715279949862694760647744762491192216... . - Vaclav Kotesovec, Nov 21 2015
E.g.f. E(x) satisfies E'(x) = 11 E(11 x) - E(x). - Robert Israel, Nov 24 2015
Equals 11^(binomial(n+1,2))*(1/11;1/11){n}, where (a;q){n} is the q-Pochhammer symbol. - G. C. Greubel, Dec 24 2015
G.f.: Sum_{n>=0} 11^(n*(n+1)/2)*x^n / Product_{k=0..n} (1 + 11^k*x). - Ilya Gutkovskiy, May 22 2017
Sum_{n>=0} (-1)^n/a(n) = A132267. - Amiram Eldar, May 07 2023

A055457 5^a(n) exactly divides 5n. Or, 5-adic valuation of 5n.

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 3, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Alford Arnold, Jun 25 2000

Keywords

Comments

More generally, consider the sequence defined by p^a(n) exactly divides p*n. For p = 3 we have A051064 and for p = 2 we have A001511.
The number of powers of 5 that divide n. - Amiram Eldar, Mar 29 2025

Examples

			a(5) = 2 since 5^2 exactly divides 5 times 5;
a(25) = 3 since 5^3 exactly divides 5 times 25;
a(125) = 4 since 5^4 exactly divides 5 times 125.
		

Crossrefs

Cf. A007949, A112765, A191610 (partial sums).

Programs

  • Maple
    seq(padic:-ordp(5*n,5), n=1..1000); # Robert Israel, Dec 07 2015
  • Mathematica
    max = 1000; s = (1/x)*Sum[x^(5^k)/(1-x^5^k), {k, 0, Log[5, max] // Ceiling }] + O[x]^max; CoefficientList[s, x] (* Jean-François Alcover, Dec 04 2015 *)
    Table[IntegerExponent[n, 5] + 1, {n, 1, 100}] (* Amiram Eldar, Sep 21 2020 *)
  • PARI
    a(n)=-sumdiv(n,d,moebius(5*d)*numdiv(n/d)) \\ Benoit Cloitre, Jun 21 2007
    
  • PARI
    a(n)=valuation(5*n,5) \\ Anders Hellström, Dec 04 2015
    
  • Python
    def A055457(n):
        c = 1
        while not (a:=divmod(n,5))[1]:
            c += 1
            n = a[0]
        return c # Chai Wah Wu, Feb 28 2025

Formula

G.f.: Sum_{k>=0} x^(5^k)/(1-x^5^k). - Ralf Stephan, Apr 12 2002
Multiplicative with a(p^e) = e+1 if p = 5, 1 otherwise.
a(n) = -Sum_{d|n} mu(5d)*tau(n/d). - Benoit Cloitre, Jun 21 2007
Dirichlet g.f.: zeta(s)/(1-1/5^s). - R. J. Mathar, Feb 09 2011
a(n) = A112765(5n). - R. J. Mathar, Jul 17 2012
a(5n) = 1 + a(n). a(5n+k) = 1 for k = 1..4. - Robert Israel, Dec 07 2015
G.f. satisfies A(x^5) = A(x) - x/(1-x). - Robert Israel, Dec 08 2015
a(n) = A112765(n) + 1. - Amiram Eldar, Sep 21 2020
Sum_{k=1..n} a(k) ~ 5*n/4. - Vaclav Kotesovec, Sep 21 2020
G.f.: Sum_{i>=1, j>=0} x^(i*5^j). - Seiichi Manyama, Mar 23 2025

A000966 n! never ends in this many 0's.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

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
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
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
The positions of 1 in the sequence of first differences (A080066) is, itself, a(n), so the sequence is "self-generating", starting from a(1) = 5. - Paul C Abbott, May 12 2025

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

Crossrefs

Cf. A000142, A027868, A080066 (first differences), A191610 (complement), A096346 (same for base 3), A055938 (same for base 2), A136767-A136774.

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

A380662 Numbers m such that Sum_{k>=0} floor(m/5^k) is prime.

Original entry on oeis.org

2, 3, 6, 11, 16, 25, 30, 34, 35, 39, 44, 49, 58, 68, 73, 79, 82, 84, 87, 89, 92, 103, 106, 111, 113, 121, 123, 126, 131, 146, 154, 155, 159, 160, 170, 183, 188, 193, 202, 207, 212, 217, 219, 224, 226, 228, 236, 248, 251, 266, 271, 279, 280, 284, 289, 295
Offset: 1

Views

Author

Clark Kimberling, Feb 19 2025

Keywords

Examples

			floor(16/1) + floor(16/5) = 19, so 16 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Sum[Floor[(n-1)/5^k], {k, 0, Floor[Log[5, n]]}]  (* A191610 *)
    Select[Range[400], PrimeQ[f[#]] &]

A381239 Primes of the form Sum_{k >= 0} floor(m/5^k) for some number m.

Original entry on oeis.org

2, 3, 7, 13, 19, 31, 37, 41, 43, 47, 53, 59, 71, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 181, 191, 193, 197, 199, 211, 227, 233, 239, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 313, 331, 337, 347, 349, 353, 359
Offset: 1

Views

Author

Clark Kimberling, Mar 09 2025

Keywords

Examples

			floor(16/1) + floor(16/5) = 19, so 19 is in the sequence.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Sum[Floor[n/5^k], {k, 0, Floor[Log[5, n]]}]  (* A191610 *)
    u=Select[Range[400], PrimeQ[f[#]] &]
    Map[f, u]

A246817 Possible number of trailing zeros in hyperfactorials (A002109).

Original entry on oeis.org

0, 5, 15, 30, 50, 100, 130, 165, 205, 250, 350, 405, 465, 530, 600, 750, 830, 915, 1005, 1100, 1300, 1405, 1515, 1630, 1750, 2125, 2255, 2390, 2530, 2675, 2975, 3130, 3290, 3455, 3625, 3975, 4155, 4340, 4530, 4725, 5125, 5330, 5540, 5755, 5975, 6425, 6655
Offset: 1

Views

Author

Chai Wah Wu, Sep 03 2014

Keywords

Comments

The number of trailing zeros in A002109 increases every 5 terms since the exponent of the factor 5 increases every 5 terms and the exponent of the factor 2 increases every 2 terms.

Crossrefs

Programs

  • Python
    from sympy import multiplicity
    A246817, p5 = [0], 0
    for n in range(5,5*10**3,5):
        p5 += multiplicity(5,n)*n
        A246817.append(p5) # Chai Wah Wu, Sep 05 2014
Showing 1-7 of 7 results.