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

A054996 Integers that can be expressed as the sum of consecutive primes in exactly 1 way.

Original entry on oeis.org

2, 3, 7, 8, 10, 11, 12, 13, 15, 18, 19, 24, 26, 28, 29, 30, 37, 39, 42, 43, 47, 48, 49, 52, 56, 58, 61, 68, 73, 75, 77, 78, 79, 84, 88, 89, 95, 98, 102, 103, 107, 113, 121, 124, 128, 129, 132, 137, 144, 149, 150, 151, 155, 156, 157, 158, 159, 160, 161, 162, 163
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			8=3+5, so 8 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 1. - Ray Chandler, Sep 20 2023

A054998 Integers that can be expressed as the sum of consecutive primes in exactly 3 ways.

Original entry on oeis.org

41, 83, 197, 199, 223, 240, 251, 281, 287, 340, 371, 401, 439, 491, 510, 593, 660, 733, 803, 857, 864, 883, 931, 941, 961, 983, 990, 991, 1012, 1060, 1061, 1099, 1104, 1187, 1236, 1283, 1313, 1361, 1381, 1392, 1433, 1439, 1493, 1511, 1523, 1524, 1553
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			41 can be expressed as 41 or 11+13+17 or 2+3+5+7+11+13, so 41 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Programs

  • Maple
    N:= 10^4: # to get all terms <= N
    P:= [0,op(select(isprime, [2,seq(i,i=3..N,2)]))]:
    nP:= nops(P);
    S:= ListTools:-PartialSums(P):
    V:= Vector(N):
    for i from 1 to nP-1 do
      for j from i+1 to nP while S[j] - S[i] <= N do
         V[S[j]-S[i]]:= V[S[j]-S[i]]+1
    od od:
    select(t -> V[t] = 3, [$1..N]): # Robert Israel, Apr 05 2017
  • Mathematica
    Module[{nn = 300, s}, s = Array[Prime, nn]; Keys@ Take[Select[KeySort@ Merge[Table[PositionIndex@ Map[Total, Partition[s, k, 1]], {k, nn/2}], Identity], Length@ # == 3 &], Floor[nn/6]]] (* Michael De Vlieger, Apr 06 2017, Version 10 *)

Formula

A054845(a(n)) = 3. - Ray Chandler, Sep 20 2023

A054997 Integers that can be expressed as the sum of consecutive primes in exactly 2 ways.

Original entry on oeis.org

5, 17, 23, 31, 36, 53, 59, 60, 67, 71, 72, 90, 97, 100, 101, 109, 112, 119, 120, 127, 131, 138, 139, 143, 152, 173, 180, 181, 187, 204, 210, 211, 221, 228, 233, 258, 263, 269, 271, 276, 300, 304, 323, 330, 331, 349, 353, 372, 373, 379, 384, 390, 395, 408
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

Examples

			5 can be expressed as 5 or 2+3, so 5 is in the sequence.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 2. - Ray Chandler, Sep 20 2023

A055001 Integers that can be expressed as the sum of consecutive primes in exactly 6 ways.

Original entry on oeis.org

34421, 130638, 229841, 235493, 271919, 295504, 345011, 347856, 358446, 358877, 414221, 429804, 434669, 480951, 488603, 532423, 532823, 543625, 561375, 621937, 626852, 655561, 687496, 703087, 734069, 746829, 810418, 824099, 888793
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 6. - Ray Chandler, Sep 20 2023

A055000 Integers that can be expressed as the sum of consecutive primes in exactly 5 ways.

Original entry on oeis.org

311, 863, 14369, 14699, 15329, 16277, 19717, 20272, 25416, 28500, 29033, 36467, 37607, 40433, 41074, 42463, 45101, 46660, 48731, 49253, 49499, 50560, 53424, 55813, 59068, 67141, 68787, 70104, 70429, 70692, 71548, 76423, 78756, 78791
Offset: 1

Views

Author

Jud McCranie, May 30 2000

Keywords

References

  • R. K. Guy, Unsolved Problems in Number Theory, section C2.

Crossrefs

Formula

A054845(a(n)) = 5. - Ray Chandler, Sep 20 2023

A067374 Integers expressible as the sum of (at least two) consecutive primes in at least 4 ways.

Original entry on oeis.org

311, 863, 1164, 1320, 1650, 1854, 2856, 2867, 3198, 3264, 3754, 4200, 4920, 5100, 5770, 5999, 6504, 8152, 10134, 10320, 10536, 10649, 11058, 12294, 12438, 12762, 12820, 12954, 12990, 14369, 14699, 14826, 15329, 15610, 15762, 16199, 16277
Offset: 1

Views

Author

Patrick De Geest, Feb 04 2002

Keywords

Examples

			E.g., 311 = 101 + 103 + 107 = 53 + 59 + 61 + 67 + 71 = 31 + 37 + 41 + 43 + 47 + 53 + 59 = 11 + 13 + 17 + 19 + 23 + 29 + 31 + 37 + 41 + 43 + 47.
		

Crossrefs

Programs

  • Mathematica
    Clear[lst,lst1,m,n,p,a,b] m=2*6!; lst={}; Do[p=Prime[a]; Do[p+=Prime[b]; If[pVladimir Joseph Stephan Orlovsky, Aug 15 2009 *)

Formula

A084143(a(n)) > 3. - Ray Chandler, Sep 20 2023

Extensions

Offset corrected by Donovan Johnson, Nov 14 2013
Showing 1-7 of 7 results.