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-10 of 321 results. Next

A110592 Number of digits in base-5 representation of n. String length of A007091.

Original entry on oeis.org

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

Views

Author

Jonathan Vos Post, Jul 29 2005

Keywords

Comments

In terms of the repetition convolution operator #, where (sequence A) # (sequence B) = the sequence consisting of A(n) copies of B(n), then this sequence is the repetition convolution A110595 # n. Over the set of positive infinite integer sequences, # gives a nonassociative noncommutative groupoid (magma) with a left identity (A000012) but no right identity, where the left identity is also a right nullifier and idempotent. For any positive integer constant c, the sequence c*A000012 = (c,c,c,c,...) is also a right nullifier; for c = 1, this is A000012; for c = 3 this is A010701.

Crossrefs

Programs

  • Mathematica
    Join[{1},IntegerLength[Range[110],5]] (* Harvey P. Dale, Aug 03 2016 *)

Formula

G.f.: 1 + (1/(1 - x))*Sum_{k>=0} x^(5^k). - Ilya Gutkovskiy, Jan 08 2017
a(n) = floor(log_5(n)) + 1 for n >= 1. - Petros Hadjicostas, Dec 12 2019

A037469 Duplicate of A007091.

Original entry on oeis.org

1, 2, 3, 4, 10, 11, 12, 13, 14, 20, 21, 22, 23, 24, 30, 31, 32, 33, 34, 40, 41, 42, 43, 44, 100, 101, 102, 103, 104, 110, 111, 112, 113, 114, 120, 121, 122, 123, 124, 130, 131, 132, 133, 134, 140, 141, 142, 143, 144, 200, 201, 202, 203
Offset: 1

Views

Author

Keywords

Formula

A007091 \ {0}. [From R. J. Mathar, Oct 20 2008]

A007089 Numbers in base 3.

Original entry on oeis.org

0, 1, 2, 10, 11, 12, 20, 21, 22, 100, 101, 102, 110, 111, 112, 120, 121, 122, 200, 201, 202, 210, 211, 212, 220, 221, 222, 1000, 1001, 1002, 1010, 1011, 1012, 1020, 1021, 1022, 1100, 1101, 1102, 1110, 1111, 1112, 1120, 1121, 1122, 1200, 1201, 1202, 1210, 1211
Offset: 0

Views

Author

Keywords

Comments

Nonnegative integers with no decimal digit > 2. Thus nonnegative integers in base 10 whose quadrupling by normal addition or multiplication requires no carry operation. - Rick L. Shepherd, Jun 25 2009

References

  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §2.3 Positional Notation, p. 47.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a007089 0 = 0
    a007089 n = 10 * a007089 n' + m where (n', m) = divMod n 3
    -- Reinhard Zumkeller, Feb 19 2012
    
  • Maple
    A007089 := proc(n) option remember;
    if n <= 0 then 0
    else
      if (n mod 3) = 0 then 10*procname(n/3) else procname(n-1) + 1 fi
    fi end:
    [seq(A007089(n), n=0..729)]; # - N. J. A. Sloane, Mar 09 2019
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 3]], {n, 0, 50}]
  • PARI
    a(n)=if(n<1,0,if(n%3,a(n-1)+1,10*a(n/3)))
    
  • PARI
    a(n)=fromdigits(digits(n,3)) \\ Charles R Greathouse IV, Jan 08 2017
    
  • Python
    def A007089(n):
      n,s = divmod(n,3); t = 1
      while n: n,r = divmod(n,3); t *= 10; s += r*t
      return s # M. F. Hasler, Feb 15 2023

Formula

a(0)=0, a(n) = 10*a(n/3) if n==0 (mod 3), a(n) = a(n-1) + 1 otherwise. - Benoit Cloitre, Dec 22 2002
a(n) = 10*a(floor(n/3)) + (n mod 3) if n > 0, a(0) = 0. - M. F. Hasler, Feb 15 2023

Extensions

More terms from James Sellers, May 01 2000

A007090 Numbers in base 4.

Original entry on oeis.org

0, 1, 2, 3, 10, 11, 12, 13, 20, 21, 22, 23, 30, 31, 32, 33, 100, 101, 102, 103, 110, 111, 112, 113, 120, 121, 122, 123, 130, 131, 132, 133, 200, 201, 202, 203, 210, 211, 212, 213, 220, 221, 222, 223, 230, 231, 232, 233, 300, 301, 302, 303, 310, 311, 312, 313, 320, 321, 322, 323, 330, 331, 332, 333
Offset: 0

Views

Author

Keywords

Comments

Nonnegative integers with no decimal digit > 3. Thus nonnegative integers in base 10 whose tripling (trebling) by normal addition or multiplication requires no carry operation. - Rick L. Shepherd, Jun 25 2009
Interpreted in base 10: a(x)+a(y) = a(z) => x+y = z. The converse is not true in general. - Karol Bacik, Sep 27 2012

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A007608, A000042, A007088 (base 2), A007089 (base 3), A007091 (base 5), A007092 (base 6), A007093 (base 7), A007094 (base 8), A007095 (base 9), A193890, A107715.

Programs

  • Haskell
    a007090 0 = 0
    a007090 n = 10 * a007090 n' + m where (n', m) = divMod n 4
    -- Reinhard Zumkeller, Apr 08 2013, Aug 11 2011
  • Maple
    A007090 := proc(n) local l: if(n=0)then return 0: fi: l:=convert(n,base,4): return op(convert(l,base,10,10^nops(l))): end: seq(A007090(n),n=0..54); # Nathaniel Johnston, May 06 2011
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 4]], {n, 0, 60}]
  • PARI
    a(n)=if(n<1,0,if(n%4,a(n-1)+1,10*a(n/4)))
    
  • PARI
    A007090(n)=sum(i=1,#n=digits(n,4),n[i]*10^(#n-i)) \\ M. F. Hasler, Jul 25 2015 (Corrected by Jinyuan Wang, Oct 02 2019)
    
  • PARI
    apply( A007090(n)=fromdigits(digits(n,4)), [0..66]) \\ M. F. Hasler, Nov 18 2019
    

Formula

a(n) = Sum_{d(i)*10^i: i=0, 1, ..., m}, where Sum_{d(i)*4^i: i=0, 1, ..., m} is the base 4 representation of n.
a(0) = 0, a(n) = 10*a(n/4) if n==0 (mod 4), a(n) = a(n-1)+1 otherwise. - Benoit Cloitre, Dec 22 2002

A007095 Numbers in base 9.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 51, 52, 53, 54, 55, 56, 57, 58, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84
Offset: 0

Views

Author

Keywords

Comments

Also numbers without 9 as a digit.
Complement of A011539: A102683(a(n)) = 0; A068505(a(n)) != a(n)). - Reinhard Zumkeller, Dec 29 2011

References

  • Julian Havil, Gamma, Exploring Euler's Constant, Princeton University Press, Princeton and Oxford, 2003, page 34.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000042 (base 1), A007088 (base 2), A007089 (base 3), A007090 (base 4), A007091 (base 5), A007092 (base 6), A007093 (base 7), A007094 (base 8); A057104, A037479.
Cf. A052382 (without 0), A052383 (without 1), A052404 (without 2), A052405 (without 3), A052406 (without 4), A052413 (without 5), A052414 (without 6), A052419 (without 7), A052421 (without 8).
Cf. A082838.

Programs

  • Haskell
    a007095 = f . subtract 1 where
       f 0 = 0
       f v = 10 * f w + r   where (w, r) = divMod v 9
    -- Reinhard Zumkeller, Oct 07 2014, Dec 29 2011
    
  • Magma
    [ n: n in [0..74] | not 9 in Intseq(n) ];  // Bruno Berselli, May 28 2011
    
  • Maple
    A007095 := proc(n) local l: if(n=0)then return 0: fi: l:=convert(n,base,9): return op(convert(l,base,10,10^nops(l))): end: seq(A007095(n),n=0..67); # Nathaniel Johnston, May 06 2011
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 9]], {n, 0, 75}]
  • PARI
    a(n)=if(n<1,0,if(n%9,a(n-1)+1,10*a(n/9)))
    
  • PARI
    A007095(n)=fromdigits(digits(n, 9)) \\ Michel Marcus, Dec 29 2018
    
  • Python
    # and others: see OEIS Wiki page (cf. LINKS).
    
  • Python
    from gmpy2 import digits
    def A007095(n): return int(digits(n,9)) # Chai Wah Wu, May 06 2025
  • sh
    seq 0 1000 | grep -v 9; # Joerg Arndt, May 29 2011
    

Formula

a(0) = 0, a(n) = 10*a(n/9) if n==0 (mod 9), a(n) = a(n-1)+1 otherwise. - Benoit Cloitre, Dec 22 2002
Sum_{n>1} 1/a(n) = A082838 = 22.92067... (Kempner series). - Bernard Schott, Dec 29 2018; edited by M. F. Hasler, Jan 13 2020

A007094 Numbers in base 8.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 40, 41, 42, 43, 44, 45, 46, 47, 50, 51, 52, 53, 54, 55, 56, 57, 60, 61, 62, 63, 64, 65, 66, 67, 70, 71, 72, 73, 74, 75, 76, 77, 100, 101, 102, 103, 104, 105, 106, 107, 110, 111
Offset: 0

Views

Author

Keywords

References

  • Jan Gullberg, Mathematics from the Birth of Numbers, W. W. Norton & Co., NY & London, 1997, §2.8 Binary, Octal, Hexadecimal, p. 64.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A057104; A000042 (base 1), A007088 (base 2), A007089 (base 3), A007090 (base 4), A007091 (base 5), A007092 (base 6), A007093 (base 7), A007095 (base 9).

Programs

  • Haskell
    a007094 0 = 0
    a007094 n = 10 * a007094 n' + m where (n', m) = divMod n 8
    -- Reinhard Zumkeller, Aug 29 2013
    
  • Maple
    A007094 := proc(n) local l: if(n=0)then return 0: fi: l:=convert(n,base,8): return op(convert(l,base,10,10^nops(l))): end: seq(A007094(n), n=0..66); # Nathaniel Johnston, May 06 2011
  • Mathematica
    Table[FromDigits[IntegerDigits[n, 8]], {n, 0, 70}]
  • PARI
    a(n)=if(n<1,0,if(n%8,a(n-1)+1,10*a(n/8)))
    
  • PARI
    apply( A007094(n)=fromdigits(digits(n,8)), [0..77]) \\ M. F. Hasler, Nov 18 2019
    
  • Python
    def a(n): return int(oct(n)[2:])
    print([a(n) for n in range(74)]) # Michael S. Branicky, Jun 28 2021

Formula

a(0) = 0; a(n) = 10*a(n/8) if n == 0 (mod 8); a(n) = a(n-1) + 1 otherwise. - Benoit Cloitre, Dec 22 2002
G.f.: sum(d>=0, 10^d*(x^(8^d) +2*x^(2*8^d) +3*x^(3*8^d) +4*x^(4*8^d) +5*x^(5*8^d) +6*x^(6*8^d) +7*x^(7*8^d)) * (1-x^(8^d)) / ((1-x^(8^(d+1)))*(1-x))). - Robert Israel, Aug 03 2014

A007093 Numbers in base 7.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 20, 21, 22, 23, 24, 25, 26, 30, 31, 32, 33, 34, 35, 36, 40, 41, 42, 43, 44, 45, 46, 50, 51, 52, 53, 54, 55, 56, 60, 61, 62, 63, 64, 65, 66, 100, 101, 102, 103, 104, 105, 106, 110, 111, 112, 113, 114, 115, 116, 120
Offset: 0

Views

Author

Keywords

References

  • Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See p. 67.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    A007093 := proc(n) local l: if(n=0)then return 0: fi: l:=convert(n,base,7): return op(convert(l,base,10,10^nops(l))): end: seq(A007093(n),n=0..63); # Nathaniel Johnston, May 06 2011
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 7]], {n, 0, 66}]
  • PARI
    a(n)=if(n<1,0,if(n%7,a(n-1)+1,10*a(n/7)))
    
  • PARI
    a(n) = fromdigits(digits(n, 7)); \\ Michel Marcus, Aug 12 2018

Formula

a(0) = 0, a(n) = 10*a(n/7) if n==0 (mod 7), a(n) = a(n-1)+1 otherwise. - Benoit Cloitre, Dec 22 2002

A007092 Numbers in base 6.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 10, 11, 12, 13, 14, 15, 20, 21, 22, 23, 24, 25, 30, 31, 32, 33, 34, 35, 40, 41, 42, 43, 44, 45, 50, 51, 52, 53, 54, 55, 100, 101, 102, 103, 104, 105, 110, 111, 112, 113, 114, 115, 120, 121, 122, 123, 124, 125, 130, 131, 132, 133, 134, 135, 140, 141, 142, 143, 144, 145
Offset: 0

Views

Author

Keywords

Comments

Nonnegative integers with no decimal digits > 5. - Karol Bacik, Sep 25 2012

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000042 (base 1), A007088 (base 2), A007089 (base 3), A007090 (base 4), A007091 (base 5), A007093 (base 7), A007094 (base 8), A007095 (base 9).

Programs

  • Haskell
    a007092 0 = 0
    a007092 n = 10 * a007092 n' + m where (n', m) = divMod n 6
    -- Reinhard Zumkeller, Mar 06 2015
  • Maple
    A007092 := proc(n) local l: if(n=0)then return 0: fi: l:=convert(n,base,6): return op(convert(l,base,10,10^nops(l))): end: seq(A007092(n),n=0..59); # Nathaniel Johnston, May 06 2011
  • Mathematica
    Table[ FromDigits[ IntegerDigits[n, 6]], {n, 0, 65}]
  • PARI
    a(n)=if(n%6,a(n-1)+1,if(n,10*a(n/6),0))  \\ corrected by Charles R Greathouse IV, Sep 25 2012
    
  • PARI
    a(n)=n=digits(n,6);n[1]=Str(n[1]);eval(concat(n)) \\ Charles R Greathouse IV, Sep 25 2012
    
  • PARI
    apply( A007092(n)=fromdigits(digits(n, 6)), [0..66]) \\ M. F. Hasler, Nov 18 2019
    

Formula

a(0)=0, a(n) = 10*a(n/6) if n==0 (mod 6), and a(n) = a(n-1)+1 otherwise. - Benoit Cloitre, Dec 22 2002
a(n) = Sum{d(i)*10^i: i=0,1,...,m}, where Sum{d(i)*6^i: i=1,2,...,m} = n, and d(i) in {0,1,...,5}. - Karol Bacik, Sep 25 2012

A000042 Unary representation of natural numbers.

Original entry on oeis.org

1, 11, 111, 1111, 11111, 111111, 1111111, 11111111, 111111111, 1111111111, 11111111111, 111111111111, 1111111111111, 11111111111111, 111111111111111, 1111111111111111, 11111111111111111, 111111111111111111, 1111111111111111111, 11111111111111111111
Offset: 1

Views

Author

Keywords

Comments

Or, numbers written in base 1.
If p is a prime > 5 then d_{a(p)} == 1 (mod p) where d_{a(p)} is a divisor of a(p). This also gives an alternate elementary proof of the infinitude of prime numbers by the fact that for every prime p there exists at least one prime of the form k*p + 1. - Amarnath Murthy, Oct 05 2002
11 = 1*9 + 2; 111 = 12*9 + 3; 1111 = 123*9 + 4; 11111 = 1234*9 + 5; 111111 = 12345*9 + 6; 1111111 = 123456*9 + 7; 11111111 = 1234567*9 + 8; 111111111 = 12345678*9 + 9. - Vincenzo Librandi, Jul 18 2010

References

  • Albert H. Beiler, Recreations in the theory of numbers, New York, Dover, (2nd ed.) 1966. See pp. 57-58.
  • K. G. Kroeber, Mathematik der Palindrome; p. 348; 2003; ISBN 3 499 615762; Rowohlt Verlag; Germany.
  • D. Olivastro, Ancient Puzzles. Bantam Books, NY, 1993, p. 276.
  • Alfred S. Posamentier, Math Charmers, Tantalizing Tidbits for the Mind, Prometheus Books, NY, 2003, page 32.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    A000042 n = (10^n-1) `div` 9 -- James Spahlinger, Oct 08 2012
    (Common Lisp) (defun a000042 (n) (truncate (expt 10 n) 9)) ; James Spahlinger, Oct 12 2012
    
  • Magma
    [(10^n - 1)/9: n in [1..20]]; // G. C. Greubel, Nov 04 2018
    
  • Maple
    a:= n-> parse(cat(1$n)):
    seq(a(n), n=1..25);  # Alois P. Heinz, Mar 23 2018
  • Mathematica
    Table[(10^n - 1)/9, {n, 1, 18}]
    FromDigits/@Table[PadLeft[{},n,1],{n,20}] (* Harvey P. Dale, Aug 21 2011 *)
  • PARI
    a(n)=if(n<0,0,(10^n-1)/9)
    
  • Python
    def a(n): return int("1"*n) # Michael S. Branicky, Jan 01 2021
  • Sage
    [gaussian_binomial(n, 1, 10) for n in range(1, 19)]  # Zerinvary Lajos, May 28 2009
    

Formula

a(n) = (10^n - 1)/9.
G.f.: 1/((1-x)*(1-10*x)).
Binomial transform of A003952. - Paul Barry, Jan 29 2004
From Paul Barry, Aug 24 2004: (Start)
a(n) = 10*a(n-1) + 1, n > 1, a(1)=1. [Offset 1.]
a(n) = Sum_{k=0..n} binomial(n+1, k+1)*9^k. [Offset 0.] (End)
a(2n) - 2*a(n) = (3*a(n))^2. - Amarnath Murthy, Jul 21 2003
a(n) is the binary representation of the n-th Mersenne number (A000225). - Ross La Haye, Sep 13 2003
The Hankel transform of this sequence is [1,-10,0,0,0,0,0,0,0,0,...]. - Philippe Deléham, Nov 21 2007
E.g.f.: (exp(10*x) - exp(x))/9. - G. C. Greubel, Nov 04 2018
a(n) = 11*a(n-1) - 10*a(n-2). - Wesley Ivan Hurt, May 28 2021
a(n+m-2) = a(m)*a(n-1) - (a(m)-1)*a(n-2), n>1, m>0. - Matej Veselovac, Jun 07 2021
Sum_{n>=1} 1/a(n) = A065444. - Stefano Spezia, Jul 30 2024

Extensions

More terms from Paul Barry, Jan 29 2004

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
Showing 1-10 of 321 results. Next