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 49 results. Next

A324322 Numbers k such that Ld(k) == k (mod Rd(k)), where Ld(k) = A067080 and Rd(k) = A067079.

Original entry on oeis.org

12, 13, 14, 15, 16, 17, 18, 19, 32, 43, 52, 54, 65, 72, 73, 76, 87, 92, 94, 98, 103, 352, 461, 571, 792, 803, 1003
Offset: 1

Views

Author

Paolo P. Lava, Feb 22 2019

Keywords

Comments

No other term up to 2*10^10. - Giovanni Resta, Feb 22 2019

Examples

			Ld(792) = 792*79*7 = 437976, Rd(792) = 792*92*2 = 145728 and 437976 == 792 (mod 145728).
		

Crossrefs

Programs

  • Maple
    with(numtheory): P:=proc(n) local a,k;
    a:=mul(n mod 10^k, k=1..ilog10(n)+1): if a>0 then
    if n=mul(trunc(n/10^k), k=0..ilog10(n)) mod a then n;
    fi; fi; end: seq(P(i),i=1..1100);
  • Mathematica
    Select[Range[10^6], If[#2 != 0, Mod[Times @@ Map[FromDigits, NestWhileList[Most@ # &, IntegerDigits@ #1, Length@ # > 1 &]], #2] == #1] & @@ {#, Times @@ Map[FromDigits, NestWhileList[Rest@ # &, IntegerDigits@ #, Length@ # > 1 &]]} &] (* Michael De Vlieger, Feb 25 2019 *)
  • PARI
    Ld(n) = my(t=n); while(n\=10, t*=n); t; \\ A067080
    Rd(n) = prod(k=1, logint(n+!n, 10)+1, n-n\10^k*10^k); \\ A067079
    isok(k) = if (k % 10, (Ld(k) % Rd(k)) == k); \\ Michel Marcus, Jan 15 2023

A324321 Numbers k such that Rd(k) == k (mod Ld(k)), where Rd(k) = A067079 and Ld(k) = A067080.

Original entry on oeis.org

21, 23, 25, 27, 29, 31, 34, 37, 41, 45, 49, 51, 56, 61, 67, 71, 78, 81, 89, 91, 101, 109, 114, 118, 145, 175, 201, 209, 251, 267, 301, 365, 401, 501, 529, 601, 701, 801, 901, 1001, 1639, 2001, 3001, 4001, 5001, 6001, 7001, 8001, 9001, 10001, 20001, 30001, 40001
Offset: 1

Views

Author

Paolo P. Lava, Feb 22 2019

Keywords

Comments

All numbers of the form d*10^k+1, where d = 1,2,3,4,5,6,7,8,9 and k>0, are part of the sequence except 11.

Examples

			Rd(1639) = 1639*639*39*9 = 367609671, Ld(1639) = 1639*163*16*1 = 4274512 and 367609671 == 1639 (mod 4274512).
		

Crossrefs

Programs

  • Maple
    op(select(n->n=mul(n mod 10^k, k=1..ilog10(n)+1) mod mul(trunc(n/10^k), k=0..ilog10(n)),[$1..40001]));
  • Mathematica
    Select[Range[10^5], Mod[Times @@ Map[FromDigits, NestWhileList[Rest@ # &, IntegerDigits@ #, Length@ # > 1 &]], Times @@ Map[FromDigits, NestWhileList[Most@ # &, IntegerDigits@ #, Length@ # > 1 &]]] == # &] (* Michael De Vlieger, Feb 25 2019 *)

A005187 a(n) = a(floor(n/2)) + n; also denominators in expansion of 1/sqrt(1-x) are 2^a(n); also 2n - number of 1's in binary expansion of 2n.

Original entry on oeis.org

0, 1, 3, 4, 7, 8, 10, 11, 15, 16, 18, 19, 22, 23, 25, 26, 31, 32, 34, 35, 38, 39, 41, 42, 46, 47, 49, 50, 53, 54, 56, 57, 63, 64, 66, 67, 70, 71, 73, 74, 78, 79, 81, 82, 85, 86, 88, 89, 94, 95, 97, 98, 101, 102, 104, 105, 109, 110, 112, 113, 116, 117, 119, 120, 127, 128
Offset: 0

Views

Author

N. J. A. Sloane, May 20 1991; Allan Wilks, Dec 11 1999

Keywords

Comments

Also exponent of the largest power of 2 dividing (2n)! (A010050) and (2n)!! (A000165).
Write n in binary: 1ab..yz, then a(n) = 1ab..yz + ... + 1ab + 1a + 1. - Ralf Stephan, Aug 27 2003
Also numbers having a partition into distinct Mersenne numbers > 0; A079559(a(n))=1; complement of A055938. - Reinhard Zumkeller, Mar 18 2009
Wikipedia's article on the "Whitney Immersion theorem" mentions that the a(n)-dimensional sphere arises in the Immersion Conjecture proved by Ralph Cohen in 1985. - Jonathan Vos Post, Jan 25 2010
For n > 0, denominators for consecutive pairs of integral numerator polynomials L(n+1,x) for the Legendre polynomials with o.g.f. 1 / sqrt(1-tx+x^2). - Tom Copeland, Feb 04 2016
a(n) is the total number of pointers in the first n elements of a perfect skip list. - Alois P. Heinz, Dec 14 2017
a(n) is the position of the n-th a (indexing from 0) in the fixed point of the morphism a -> aab, b -> b. - Jeffrey Shallit, Dec 24 2020
Numbers that can be expressed as the sum of distinct numbers of the form 2^k - 1 (lenient Mersenne numbers, A000225). This follows from the 2N - Hamming weight definition. A corollary is that these are the numbers with no 2 in their skew-binary representation (cf. A169683). - Allan C. Wechsler, Feb 25 2025

Examples

			G.f. = x + 3*x^2 + 4*x^3 + 7*x^4 + 8*x^5 + 10*x^6 + 11*x^7 + 15*x^8 + ...
		

References

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

Crossrefs

Cf. A001511 (first differences), A122247 (partial sums), A055938 (complement).

Programs

  • Haskell
    a005187 n = a005187_list !! n
    a005187_list = 0 : zipWith (+) [1..] (map (a005187 . (`div` 2)) [1..])
    -- Reinhard Zumkeller, Nov 07 2011, Oct 05 2011
    
  • Magma
    [n + Valuation(Factorial(n), 2): n in [0..70]]; // Vincenzo Librandi, Jun 11 2019
    
  • Maple
    A005187 := n -> 2*n - add(i, i=convert(n, base, 2)):
    seq(A005187(n), n=0..65); # Peter Luschny, Apr 08 2014
  • Mathematica
    a[0] = 0; a[n_] := a[n] = a[Floor[n/2]] + n; Table[ a[n], {n, 0, 50}] (* or *)
    Table[IntegerExponent[(2n)!, 2], {n, 0, 65}] (* Robert G. Wilson v, Apr 19 2006 *)
    Table[2n-DigitCount[2n,2,1],{n,0,70}] (* Harvey P. Dale, May 24 2014 *)
  • PARI
    {a(n) = if( n<0, 0, valuation((2*n)!, 2))}; /* Michael Somos, Oct 24 2002 */
    
  • PARI
    {a(n) = if( n<0, 0, sum(k=1, n, (2*n)\2^k))}; /* Michael Somos, Oct 24 2002 */
    
  • PARI
    {a(n) = if( n<0, 0, 2*n - subst( Pol( binary( n ) ), x, 1) ) }; /* Michael Somos, Aug 28 2007 */
    
  • PARI
    a(n)=my(s=n);while(n>>=1,s+=n);s \\ Charles R Greathouse IV, Apr 07 2012
    
  • PARI
    a(n)=2*n-hammingweight(n) \\ Charles R Greathouse IV, Jan 07 2013
    
  • Python
    def A005187(n): return 2*n-bin(n).count('1') # Chai Wah Wu, Jun 03 2021
  • Sage
    @CachedFunction
    def A005187(n): return A005187(n//2) + n if n > 0 else 0
    [A005187(n) for n in range(66)]  # Peter Luschny, Dec 13 2012
    

Formula

a(n) = A011371(2n+1) = A011371(n) + n, n >= 0.
A046161(n) = 2^a(n).
For m>0, let q = floor(log_2(m)); a(2m+1) = 2^q + 3m + Sum_{k>=1} floor((m-2^q)/2^k); a(2m) = a(2m+1) - 1. - Len Smiley
a(n) = Sum_{k >= 0} floor(n/2^k) = n + A011371(n). - Henry Bottomley, Jul 03 2001
G.f.: A(x) = Sum_{k>=0} x^(2^k)/((1-x)*(1-x^(2^k))). - Ralf Stephan, Dec 24 2002
a(n) = Sum_{k=1..n} A001511(k), sum of binary Hamming distances between consecutive integers up to n. - Gary W. Adamson, Jun 15 2003
Conjecture: a(n) = 2n + O(log(n)). - Benoit Cloitre, Oct 07 2003 [true as a(n) = 2*n - hamming_weight(2*n). Joerg Arndt, Jun 10 2019]
Sum_{n=2^k..2^(k+1)-1} a(n) = 3*4^k - (k+4)*2^(k-1) = A085354(k). - Philippe Deléham, Feb 19 2004
From Hieronymus Fischer, Aug 14 2007: (Start)
Recurrence: a(n) = n + a(floor(n/2)); a(2n) = 2n + a(n); a(n*2^m) = 2*n*(2^m-1) + a(n).
a(2^m) = 2^(m+1) - 1, m >= 0.
Asymptotic behavior: a(n) = 2n + O(log(n)), a(n+1) - a(n) = O(log(n)); this follows from the inequalities below.
a(n) <= 2n-1; equality holds for powers of 2.
a(n) >= 2n-1-floor(log_2(n)); equality holds for n = 2^m-1, m > 0.
lim inf (2n - a(n)) = 1, for n-->oo.
lim sup (2n - log_2(n) - a(n)) = 0, for n-->oo.
lim sup (a(n+1) - a(n) - log_2(n)) = 1, for n-->oo. (End)
a(n) = 2n - A000120(n). - Paul Barry, Oct 26 2007
PURRS demo results: Bounds for a(n) = n + a(n/2) with initial conditions a(1) = 1: a(n) >= -2 + 2*n - log(n)*log(2)^(-1), a(n) <= 1 + 2*n for each n >= 1. - Alexander R. Povolotsky, Apr 06 2008
If n = 2^a_1 + 2^a_2 + ... + 2^a_k, then a(n) = n-k. This can be used to prove that 2^n maximally divides (2n!)/n!. - Jon Perry, Jul 16 2009
a(n) = Sum_{k>=0} A030308(n,k)*A000225(k+1). - Philippe Deléham, Oct 16 2011
a(n) = log_2(denominator(binomial(-1/2,n))). - Peter Luschny, Nov 25 2011
a(2n+1) = a(2n) + 1. - M. F. Hasler, Jan 24 2015
a(n) = A004134(n) - n. - Cyril Damamme, Aug 04 2015
G.f.: (1/(1 - x))*Sum_{k>=0} (2^(k+1) - 1)*x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Jul 23 2017

A011371 a(n) = n minus (number of 1's in binary expansion of n). Also highest power of 2 dividing n!.

Original entry on oeis.org

0, 0, 1, 1, 3, 3, 4, 4, 7, 7, 8, 8, 10, 10, 11, 11, 15, 15, 16, 16, 18, 18, 19, 19, 22, 22, 23, 23, 25, 25, 26, 26, 31, 31, 32, 32, 34, 34, 35, 35, 38, 38, 39, 39, 41, 41, 42, 42, 46, 46, 47, 47, 49, 49, 50, 50, 53, 53, 54, 54, 56, 56, 57, 57, 63, 63, 64, 64, 66, 66, 67, 67, 70
Offset: 0

Views

Author

Keywords

Comments

Terms of A005187 repeated. - Lekraj Beedassy, Jul 06 2004
This sequence shows why in binary 0 and 1 are the only two numbers n such that n equals the sum of its digits raised to the consecutive powers (equivalent to the base-10 sequence A032799). 1 raised to any consecutive power is still 1 and thus any sum of digits raised to consecutive powers for any n > 1 falls short of equaling the value of n by the n-th term of this sequence. - Alonso del Arte, Jul 27 2004
Also the number of trailing zeros in the base-2 representation of n!. - Hieronymus Fischer, Jun 18 2007
Partial sums of A007814. - Philippe Deléham, Jun 21 2012
If n is in A089633 and n > 0, then a(n) = n - floor(log_2(n+1)). - Douglas Latimer, Jul 25 2012
For n > 1, denominators of integral numerator polynomials L(n,x) for the Legendre polynomials with o.g.f. 1/sqrt(1 - t*x + x^2). - Tom Copeland, Feb 04 2016
The definition of this sequence explains why, for n > 1, the highest power of 2 dividing n! added to the number of 1's in the binary expansion of n is equal to n. This result is due to the French mathematician Adrien Legendre (1752-1833) [see the Honsberger reference]. - Bernard Schott, Apr 07 2017
a(n) is the total number of 2's in the prime factorizations over the first n positive integers. The expected number of 2's in the factorization of an integer n is 1 (as n->infinity). Generally, the expected number of p's (for a prime p) is 1/(p-1). - Geoffrey Critzer, Jun 05 2017

Examples

			a(3) = 1 because 3 in binary is 11 (two 1's) and 3 - 2 = 1.
a(4) = 3 because 4 in binary is 100 (one 1 and two 0's) and 4 - 1 = 3.
a(5) = 3 because 5 in binary is 101 (a zero between two 1's) and 5 - 2 = 3.
a(100) = 97.
a(10^3) = 994.
a(10^4) = 9995.
a(10^5) = 99994.
a(10^6) = 999993.
a(10^7) = 9999992.
a(10^8) = 99999988.
a(10^9) = 999999987.
G.f. = x^2 + x^3 + 3*x^4 + 3*x^5 + 4*x^6 + 4*x^7 + 7*x^8 + 7*x^9 + 8*x^10 + ...
		

References

  • K. Atanassov, On Some of Smarandache's Problems, section 7, on the 61st problem, page 42, American Research Press, 1999, 16-21.
  • G. Bachman, Introduction to p-Adic Numbers and Valuation Theory, Academic Press, 1964; see Lemma 3.1.
  • L. Comtet, Advanced Combinatorics, Reidel, 1974, p. 305.
  • H. Davenport, The Higher Arithmetic, 7th ed. 1999, Cambridge University Press, p. 216, exercise 1.07.
  • R. Honsberger, Mathematical Gems II, Dolciani Mathematical Expositions, 1976, pp. 1-6.

Crossrefs

a(n) = Sum_{k=1..n} A007814(k), n >= 1, a(0) = 0.

Programs

  • Haskell
    a011371 n = n - a000120 n  -- Reinhard Zumkeller, Jan 24 2014
    
  • Magma
    [Valuation(Factorial(n), 2): n in [0..80]]; // Bruno Berselli, Aug 05 2013
    
  • Maple
    A011371(n) = RETURN(((2^(l))-1)+sum('(j*floor((n-(2^l)+2^j)/(2^(j+1))))','j'=1..l)); # after K. Atanassov. Here l is [ log2(n) ].
    A011371 := n -> n - add(i,i=convert(n,base,2)): # Peter Luschny, May 02 2009
    read("transforms") : A011371 := proc(n) n-wt(n) ; end proc: # R. J. Mathar, May 15 2013
  • Mathematica
    -1 + Length[ Last[ Split[ IntegerDigits[ 2(n!), 2 ] ] ] ], FoldList[ Plus, 0, Fold[ Flatten[ {#1, #2, #1} ]&, 0, Range[ 6 ] ] ]
    Table[IntegerExponent[n!, 2], {n, 0, 127}]
    Table[n - DigitCount[n, 2, 1], {n, 0, 127}]
    Table[t = 0; p = 2; While[s = Floor[n/p]; t = t + s; s > 0, p *= 2]; t, {n, 0, 100} ]
  • PARI
    {a(n) = if( n<0, 0, valuation(n!, 2))}; /* Michael Somos, Oct 24 2002 */
    
  • PARI
    {a(n) = if( n<0, 0, sum(k=1, n, n\2^k))}; /* Michael Somos, Oct 24 2002 */
    
  • PARI
    {a(n) = if( n<0, 0, n - subst( Pol( binary( n ) ), x, 1))}; /* Michael Somos, Aug 28 2007 */
    
  • PARI
    a(n)=sum(k=1,log(n+1)\log(2),n>>k) \\ Charles R Greathouse IV, Oct 03 2012
    
  • PARI
    a(n)=my(s);while(n>>=1,s+=n);s \\ Charles R Greathouse IV, Aug 09 2013
    
  • PARI
    a(n) = n - hammingweight(n); \\ Michel Marcus, Jun 05 2014
    
  • Python
    [n - bin(n)[2:].count("1") for n in range(101)] # Indranil Ghosh, Apr 09 2017
    
  • Python
    # 3.10+
    def A011371(n): return n-n.bit_count() # Chai Wah Wu, Jul 09 2022

Formula

a(n) = a(floor(n/2)) + floor(n/2) = floor(n/2) + floor(n/4) + floor(n/8) + floor(n/16) + ... - Henry Bottomley, Apr 24 2001
G.f.: A(x) = (1/(1 - x))*Sum_{k>=1} x^(2^k)/(1 - x^(2^k)). - Ralf Stephan, Apr 11 2002
a(n) = n - A000120(n). - Lekraj Beedassy, Sep 01 2003
a(n) = A005187(n) - n, n >= 0.
a(n) = A007814(A000142(n)). - Reinhard Zumkeller, Apr 09 2004
From Hieronymus Fischer, Jun 25 and Aug 13 2007: (Start)
a(n) = Sum_{k=2..n} Sum_{j|k, j >= 2} (floor(log_2(j)) - floor(log_2(j - 1))).
The g.f. can be expressed in terms of a Lambert series, in that 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 is a power of 2, otherwise b(k) = 0.
G.f.: g(x) = (1/(1-x))*Sum_{k>0} c(k)*x^k, where c(k) = Sum_{j>1, j|k} (floor(log_2(j)) - floor(log_2(j-1))).
Recurrence:
a(n) = floor(n/2) + a(floor(n/2));
a(2*n) = n + a(n);
a(n*2^m) = n*(2^m - 1) + a(n).
a(2^m) = 2^m - 1, m >= 0.
Asymptotic behavior:
a(n) = n + O(log(n)),
a(n+1) - a(n) = O(log(n)), which follows from the inequalities below.
a(n) <= n - 1; equality holds for powers of 2.
a(n) >= n - 1 - floor(log_2(n)); equality holds for n = 2^m - 1, m > 0.
lim inf (n - a(n)) = 1, for n->oo.
lim sup (n - log_2(n) - a(n)) = 0, for n->oo.
lim sup (a(n+1) - a(n) - log_2(n)) = 0, for n->oo. (End)
a(n) = Sum_{k >= 0} A030308(n, k)*A000225(k). - Philippe Deléham, Oct 16 2011
a(n) = Sum_{k=0..floor(log_2(n+1))} f^(k+1)(n), where f(n) = (n - (n mod 2))/2 and f^(k+1) is the (k+1)-th composition of f. - Joseph Wheat, Mar 01 2018
a(n) = Sum_{k=1..floor(n/2)} floor(log_2(n/k)). - Ammar Khatab, Feb 01 2025

Extensions

Examples added by Hieronymus Fischer, Jun 06 2012

A048651 Decimal expansion of Product_{k >= 1} (1 - 1/2^k).

Original entry on oeis.org

2, 8, 8, 7, 8, 8, 0, 9, 5, 0, 8, 6, 6, 0, 2, 4, 2, 1, 2, 7, 8, 8, 9, 9, 7, 2, 1, 9, 2, 9, 2, 3, 0, 7, 8, 0, 0, 8, 8, 9, 1, 1, 9, 0, 4, 8, 4, 0, 6, 8, 5, 7, 8, 4, 1, 1, 4, 7, 4, 1, 0, 6, 6, 1, 8, 4, 9, 0, 2, 2, 4, 0, 9, 0, 6, 8, 4, 7, 0, 1, 2, 5, 7, 0, 2, 4, 2, 8, 4, 3, 1, 9, 3, 3, 4, 8, 0, 7, 8, 2
Offset: 0

Views

Author

Keywords

Comments

This is the limiting probability that a large random binary matrix is nonsingular (cf. A002884).
This constant is very close to 2^(13/24) * sqrt(Pi/log(2)) / exp(Pi^2/(6*log(2))) = 0.288788095086602421278899775042039398383022429351580356839... - Vaclav Kotesovec, Aug 21 2018
This constant is irrational (see Penn link). - Paolo Xausa, Dec 09 2024

Examples

			(1/2)*(3/4)*(7/8)*(15/16)*... = 0.288788095086602421278899721929230780088911904840685784114741...
		

References

  • Steven R. Finch, Mathematical Constants, Cambridge, 2003, pp. 318, 354-361.

Crossrefs

Programs

  • Mathematica
    RealDigits[ Product[1 - 1/2^i, {i, 100}], 10, 111][[1]] (* Robert G. Wilson v, May 25 2011 *)
    RealDigits[QPochhammer[1/2], 10, 100][[1]] (* Jean-François Alcover, Nov 18 2015 *)
  • PARI
    default(realprecision, 20080); x=prodinf(k=1, -1/2^k, 1); x*=10; for (n=0, 20000, d=floor(x); x=(x-d)*10; write("b048651.txt", n, " ", d)); \\ Harry J. Smith, May 07 2009

Formula

exp(-Sum_{k>0} sigma_1(k)/k*2^(-k)) = exp(-Sum_{k>0} A000203(k)/k*2^(-k)). - Hieronymus Fischer, Jul 28 2007
From Hieronymus Fischer, Aug 13 2007: (Start)
Equals lim inf Product_{k=0..floor(log_2(n))} floor(n/2^k)*2^k/n for n->oo.
Equals lim inf A098844(n)/n^(1+floor(log_2(n)))*2^(1/2*(1+floor(log_2(n)))*floor(log_2(n))) for n->oo.
Equals lim inf A098844(n)/n^(1+floor(log_2(n)))*2^A000217(floor(log_2(n))) for n->oo.
Equals lim inf A098844(n)/(n+1)^((1+log_2(n+1))/2) for n->oo.
Equals (1/2)*exp(-Sum_{n>0} 2^(-n)*Sum_{k|n} 1/(k*2^k)). (End)
Limit of A177510(n)/A000079(n-1) as n->infinity (conjecture). - Mats Granvik, Mar 27 2011
Product_{k >= 1} (1-1/2^k) = (1/2; 1/2){infinity}, where (a;q){infinity} is the q-Pochhammer symbol. - G. C. Greubel, Nov 27 2015
exp(Sum_{n>=1}(1/n/(1 - 2^n))) (according to Mathematica). - Mats Granvik, Sep 07 2016
(Sum_{k>0} (4^k-1)/(Product_{i=1..k} ((4^i-1)*(2*4^i-1))))*2 = 2/7 + 2/(3*7*31) + 2/(3*7*15*31*127)+2/(3*7*15*31*63*127*511) + ... (conjecture). - Werner Schulte, Dec 22 2016
Equals Sum_{k=-oo..oo} (-1)^k/2^((3*k+1)*k/2) (by Euler's pentagonal number theorem). - Amiram Eldar, Aug 13 2020
From Peter Bala, Dec 15 2020: (Start)
Constant C = Sum_{n >= 0} (-1)^n/( Product_{k = 1..n} (2^k - 1) ). The above conjectural result by Schulte follows by adding terms of this series in pairs.
C = (1/2)*Sum_{n >= 0} (-1/2)^n/( Product_{k = 1..n} (2^k - 1) ).
C = (3/8)*Sum_{n >= 0} (-1/4)^n/( Product_{k = 1..n} (2^k - 1) ).
1/C = Sum_{n >= 0} 2^(n*(n-1)/2)/( Product_{k = 1..n} (2^k - 1) ).
C = 1 - Sum_{n >= 0} (1/2)^(n+1)*Product_{k = 1..n} (1 - 1/2^k).
This latter identity generalizes as:
C = Sum_{n >= 0} (1/4)^(n+1)*Product_{k = 1..n} (1 - 1/2^k),
3*C = 1 - Sum_{n >= 0} (1/8)^(n+1)*Product_{k = 1..n} (1 - 1/2^k),
3*7*C = 6 + Sum_{n >= 0} (1/16)^(n+1)*Product_{k = 1..n} (1 - 1/2^k),
3*7*15*C = 91 - Sum_{n >= 0} (1/32)^(n+1)*Product_{k = 1..n} (1 - 1/2^k),
and so on, where the sequence [1, 0, 1, 6, 91, ...] is A005327.
(End)
From Amiram Eldar, Feb 19 2022: (Start)
Equals sqrt(2*Pi/log(2)) * exp(log(2)/24 - Pi^2/(6*log(2))) * Product_{k>=1} (1 - exp(-4*k*Pi^2/log(2))) (McIntosh, 1995).
Equals Sum_{n>=0} (-1)^n/A005329(n).
Equals exp(-A335764). (End)
Equals 1/A065446. - Hugo Pfoertner, Nov 23 2024

Extensions

Corrected by Hieronymus Fischer, Jul 28 2007

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

A054899 a(n) = Sum_{k>0} floor(n/10^k).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 11, 11, 11
Offset: 0

Views

Author

Henry Bottomley, May 23 2000

Keywords

Comments

The old definition of this sequence was "Highest power of 10 dividing n!", but that is wrong (see A027868). For example, the highest power of 10 dividing 5!=120 is 1; however, a(5)=0. - Hieronymus Fischer, Jun 18 2007
Highest power of 10 dividing the quotient of multifactorials Product_{k>=1} M(10^k, 10^k*floor(n/10^k)) /( Product_{k>=1} M(10^(k-1), 10^(k-1) * floor(n/10^k)) ) where M(r,s) is the r-multifactorial (r>=1) of s which is defined by M(r,s) = s*M(r,s-r) for s > 0, M(r,s) = 1 for s <= 0. This is because that quotient of multifactorials evaluates to the product 10^floor(n/10)*10^floor(n/100)*... - Hieronymus Fischer, Jun 14 2007
Partial sums of A122840. - Hieronymus Fischer, Jun 06 2012
Called the "terminating nines function" by Kennedy et al. (1989). a(n) is the number of terminating nines which occur up to n but not including n. - Amiram Eldar, Sep 06 2024

Examples

			          a(11) = 1
         a(111) = 12.
        a(1111) = 123.
       a(11111) = 1234.
      a(111111) = 12345.
     a(1111111) = 123456.
    a(11111111) = 1234567.
   a(111111111) = 12345678.
  a(1111111111) = 123456789.
		

Crossrefs

Cf. A011371 and A054861 for analogs involving powers of 2 and 3.
Different from the highest power of 10 dividing n! (see A027868 for reference).

Programs

  • Magma
    m:=10;
    function a(n) // a = A054899, m = 10
      if n eq 0 then return 0;
      else return a(Floor(n/m)) + Floor(n/m);
      end if; end function;
    [a(n): n in [0..103]]; // G. C. Greubel, Apr 28 2023
    
  • Mathematica
    Table[t=0; p=10; While[s=Floor[n/p]; t=t+s; s>0, p*=10]; t, {n,0,100}]
  • PARI
    a(n)=my(s);while(n\=10,s+=n);s \\ Charles R Greathouse IV, Jul 19 2011
    
  • SageMath
    m=10 # a = A054899
    def a(n): return 0 if (n==0) else a(n//m) + (n//m)
    [a(n) for n in range(104)] # G. C. Greubel, Apr 28 2023

Formula

a(n) = floor(n/10) + floor(n/100) + floor(n/1000) + ...
a(n) = (n - A007953(n))/9.
From Hieronymus Fischer, Jun 14 2007, Jun 25 2007, and Aug 13 2007: (Start)
a(n) = Sum_{k>0} floor(n/10^k).
a(n) = Sum_{k=10..n} Sum_{j|k, j>=10} ( floor(log_10(j)) -floor(log_10(j-1)) ).
G.f.: g(x) = ( Sum_{k>0} x^(10^k)/(1-x^(10^k)) )/(1-x).
G.f. expressed in terms of Lambert series:
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 10, 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_10(j)) - floor(log_10(j-1)) ).
a(n) = Sum_{k=0..floor(log_10(n))} ds_10(floor(n/10^k))*10^k - n where ds_10(x) = digital sum of x in base 10.
a(n) = Sum_{k=0..floor(log_10(n))} A007953(floor(n/10^k))*10^k - n.
Recurrence:
a(n) = floor(n/10) + a(floor(n/10)).
a(10*n) = n + a(n).
a(n*10^m) = n*(10^m-1)/9 + a(n).
a(k*10^m) = k*(10^m-1)/9, for 0 <= k < 10, m >= 0.
Asymptotic behavior:
a(n) = n/9 + O(log(n)),
a(n+1) - a(n) = O(log(n)), which follows from the inequalities below.
a(n) <= (n - 1)/9; equality holds for powers of 10.
a(n) >= n/9 - 1 - floor(log_10(n)); equality holds for n=10^m-1, m>0.
lim inf (n/9 - a(n)) = 1/9, for n --> oo.
lim sup (n/9 - log_10(n) - a(n)) = 0, for n --> oo.
lim sup (a(n+1) - a(n) - log_10(n)) = 0, for n --> oo. (End)

Extensions

An incorrect g.f. was deleted by N. J. A. Sloane, Sep 13 2009
Examples added by Hieronymus Fischer, Jun 06 2012

A054861 Greatest k such that 3^k divides n!.

Original entry on oeis.org

0, 0, 0, 1, 1, 1, 2, 2, 2, 4, 4, 4, 5, 5, 5, 6, 6, 6, 8, 8, 8, 9, 9, 9, 10, 10, 10, 13, 13, 13, 14, 14, 14, 15, 15, 15, 17, 17, 17, 18, 18, 18, 19, 19, 19, 21, 21, 21, 22, 22, 22, 23, 23, 23, 26, 26, 26, 27, 27, 27, 28, 28, 28, 30, 30, 30, 31, 31, 31, 32, 32, 32, 34, 34, 34, 35, 35
Offset: 0

Views

Author

Henry Bottomley, May 22 2000

Keywords

Comments

Also the number of trailing zeros in the base-3 representation of n!. - Hieronymus Fischer, Jun 18 2007
Also the highest power of 6 dividing n!. - Hieronymus Fischer, Aug 14 2007
A column of A090622. - Alois P. Heinz, Oct 05 2012
The 'missing' values are listed in A096346. - Stanislav Sykora, Jul 16 2014

Examples

			a(100) = 48.
a(10^3) = 498.
a(10^4) = 4996.
a(10^5) = 49995.
a(10^6) = 499993.
a(10^7) = 4999994.
a(10^8) = 49999990.
a(10^9) = 499999993.
		

Crossrefs

Cf. A011371 (for analog involving powers of 2). See also A027868.
Cf. A004128 (for a(3n)).

Programs

Formula

a(n) = floor(n/3) + floor(n/9) + floor(n/27) + floor(n/81) + ... .
a(n) = (n - A053735(n))/2.
a(n+1) = Sum_{k=1..n} A007949(k). - Benoit Cloitre, Mar 24 2002
From Hieronymus Fischer, Jun 18, Jun 25 and Aug 14 2007: (Start)
G.f.: (1/(1-x))*Sum_{k>0} x^(3^k)/(1-x^(3^k)).
a(n) = Sum_{k=3..n} Sum_{j>=3, j|k} (floor(log_3(j)) - floor(log_3(j-1))).
G.f.: 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 3, otherwise b(k)=0.
G.f.: (1/(1-x))*Sum_{k>0} c(k)*x^k, where c(k) = Sum_{j>1, j|k} (floor(log_3(j)) - floor(log_3(j-1))).
Recurrence:
a(n) = floor(n/3) + a(floor(n/3));
a(3*n) = n + a(n);
a(n*3^m) = n*(3^m-1)/2 + a(n).
a(k*3^m) = k*(3^m-1)/2, for 0 <= k < 3, m >= 0.
Asymptotic behavior:
a(n) = n/2 + O(log(n)),
a(n+1) - a(n) = O(log(n)); this follows from the inequalities below.
a(n) <= (n-1)/2; equality holds for powers of 3.
a(n) >= (n-2)/2 - floor(log_3(n)); equality holds for n = 3^m - 1, m > 0.
lim inf (n/2 - a(n)) = 1/2 for n->oo.
lim sup (n/2 - log_3(n) - a(n)) = 0 for n->oo.
lim sup (a(n+1) - a(n) - log_3(n)) = 0 for n->oo. (End)
a(n) = A007949(n!). - R. J. Mathar, Sep 03 2016
From R. J. Mathar, Jul 08 2021: (Start)
a(n) = A122841(n!).
Partial sums of A007949. (End)
a(n) = A007949(A000142(n)). - David A. Corneth, Nov 02 2023

Extensions

Examples added by Hieronymus Fischer, Jun 06 2012
New name by David A. Corneth, Nov 02 2023

A098844 a(1)=1, a(n) = n*a(floor(n/2)).

Original entry on oeis.org

1, 2, 3, 8, 10, 18, 21, 64, 72, 100, 110, 216, 234, 294, 315, 1024, 1088, 1296, 1368, 2000, 2100, 2420, 2530, 5184, 5400, 6084, 6318, 8232, 8526, 9450, 9765, 32768, 33792, 36992, 38080, 46656, 47952, 51984, 53352, 80000, 82000, 88200, 90300
Offset: 1

Views

Author

Benoit Cloitre, Nov 03 2004

Keywords

Examples

			a(10) = floor(10/2^0)*floor(10/2^1)*floor(10/2^2)*floor(10/2^3) = 10*5*2*1 = 100;
a(17) = 1088 since 17 = 10001(base 2) and so a(17) = 10001*1000*100*10*1(base 2) = 17*8*4*2*1 = 1088.
		

Crossrefs

For formulas regarding a general parameter p (i.e., terms floor(n/p^k)) see A132264.
For the product of terms floor(n/p^k) for p=3 to p=12 see A132027(p=3)-A132033(p=9), A067080(p=10), A132263(p=11), A132264(p=12).
For the products of terms 1+floor(n/p^k) see A132269-A132272, A132327, A132328.

Programs

  • Mathematica
    lst={};Do[p=n;s=1;While[p>1,p=IntegerPart[p/2];s*=p;];AppendTo[lst,s],{n,1,6!,2}];lst (* Vladimir Joseph Stephan Orlovsky, Jul 28 2009 *)
  • PARI
    a(n)=if(n<2,1,n*a(floor(n/2)))
    
  • Python
    from math import prod
    def A098844(n): return n*prod(n//2**k for k in range(1,n.bit_length()-1)) # Chai Wah Wu, Jun 07 2022

Formula

a(2^n) = 2^(n*(n+1)/2) = A006125(n+1).
From Hieronymus Fischer, Aug 13 2007: (Start)
a(n) = Product_{k=0..floor(log_2(n))} floor(n/2^k), n>=1.
Recurrence:
a(n*2^m) = n^m*2^(m(m+1)/2)*a(n).
a(n) <= n^((1+log_2(n))/2) = 2^A000217(log_2(n)); equality iff n is a power of 2.
a(n) >= c(n)*(n+1)^((1 + log_2(n+1))/2) for n != 2,
where c(n) = Product_{k=1..floor(log_2(n))} (1 - 1/2^k); equality holds iff n+1 is a power of 2.
a(n) > c*(n+1)^((1 + log_2(n+1))/2)
where c = 0.288788095086602421... (see constant A048651).
lim inf a(n)/n^((1+log_2(n))/2)=0.288788095086602421... for n-->oo.
lim sup a(n)/n^((1+log_2(n))/2) = 1 for n-->oo.
lim inf a(n)/a(n+1) = 0.288788095086602421... for n-->oo (see constant A048651).
a(n) = O(n^((1+log_2(n))/2)). (End)

Extensions

Formula section edited by Hieronymus Fischer, Jun 13 2012

A132038 Decimal expansion of Product_{k>0} (1-1/10^k).

Original entry on oeis.org

8, 9, 0, 0, 1, 0, 0, 9, 9, 9, 9, 8, 9, 9, 9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 9
Offset: 0

Views

Author

Hieronymus Fischer, Aug 14 2007

Keywords

Examples

			0.8900100999989990000001000...
		

Crossrefs

Programs

  • Mathematica
    digits = 105; Clear[p]; p[n_] := p[n] = RealDigits[Product[1-1/10^k , {k, 1, n}], 10, digits] // First; p[10]; p[n=20]; While[p[n] != p[n/2], n = 2*n]; p[n] (* Jean-François Alcover, Feb 17 2014 *)
    RealDigits[QPochhammer[1/10], 10, 105][[1]] (* Jean-François Alcover, Nov 18 2015 *)
    N[QPochhammer[1/10,1/10]] (* G. C. Greubel, Nov 30 2015 *)
  • PARI
    prodinf(x=1,-.1^x,1) \\ Charles R Greathouse IV, Nov 16 2013

Formula

Equals exp( -Sum_{n>0} sigma_1(n)/(n*10^n) ).
Equals (1/10; 1/10){infinity}, where (a; q){infinity} is the q-Pochhammer symbol. - G. C. Greubel, Nov 30 2015
From Amiram Eldar, May 09 2023: (Start)
Equals sqrt(2*Pi/log(10)) * exp(log(10)/24 - Pi^2/(6*log(10))) * Product_{k>=1} (1 - exp(-4*k*Pi^2/log(10))) (McIntosh, 1995).
Equals Sum_{n>=0} (-1)^n/A027878(n). (End)
Showing 1-10 of 49 results. Next