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-2 of 2 results.

A073642 Replace 2^k in the binary representation of n with k (i.e., if n = 2^b + 2^c + 2^d + ... then a(n) = b + c + d + ...).

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 3, 3, 3, 3, 4, 4, 5, 5, 6, 6, 4, 4, 5, 5, 6, 6, 7, 7, 7, 7, 8, 8, 9, 9, 10, 10, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 9, 9, 10, 10, 11, 11, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 14, 14, 15, 15, 6, 6, 7, 7, 8, 8, 9, 9, 9, 9, 10, 10, 11, 11, 12, 12, 10, 10, 11, 11, 12, 12, 13, 13
Offset: 0

Views

Author

Benoit Cloitre, Aug 29 2002

Keywords

Comments

For n >= 1, a(n) is the n-th row sum of the irregular triangle A133457. - Vladimir Shevelev, Dec 14 2015
For n >= 0, 2^a(n) is the number of partitions of n whose dimension (given by the hook-length formula) is an odd integer. See the MacDonald reference. - Arvind Ayyer, May 12 2016

Examples

			9 = 2^3 + 2^0, hence a(9) = 3 + 0 = 3;
25 = 2^4 + 2^3 + 2^0, hence a(25) = 4 + 3 + 0 = 7.
		

Crossrefs

Programs

  • Haskell
    a073642 = sum . zipWith (*) [0..] . a030308_row
    -- Reinhard Zumkeller, Jun 01 2013
    
  • Maple
    A073642 := proc(n)
            local bdgs ;
            bdgs := convert(n,base,2) ;
            add( op(i,bdgs)*(i-1), i=1..nops(bdgs)) ;
    end proc: # R. J. Mathar, Nov 17 2011
  • Mathematica
    Total[Flatten[Position[Rest[Reverse[IntegerDigits[#, 2]]], 1]]] & /@ Range[0, 87] (* Jayanta Basu, Jul 03 2013 *)
  • PARI
    a(n)=sum(i=1,length(binary(n)), component(binary(n),i)*(length(binary(n))-i))
    
  • PARI
    a(n) = my(b=binary(n)); b*-[-#b+1..0]~; \\ Ruud H.G. van Tol, Oct 17 2023
    
  • Python
    def A073642(n):
        a, i = 0, 0
        while n > 0:
            a, n, i = a+(n%2)*i, n//2, i+1
        return a
    print([A073642(n) for n in range(30)]) # A.H.M. Smeets, Aug 17 2019

Formula

a(n) = log_2(A059867(n)).
It seems that for n > 10 a(n) < n/(2*log(n)) and that Sum_{k=1..n} a(k) is asymptotic to C*n*log(n)^2 with 1/2 > C > 0.47.
a(1)=0, a(2n) = a(n) + e1(n), a(2n+1) = a(2n), where e1(n) = A000120(n). - Ralf Stephan, Jun 19 2003
If n = 2^log_2(n) then a(n) = log_2(n); otherwise, a(n) = log_2(n) + a(n-2^log_2(n)), where log_2=A000523. a(2*n+1) = a(2*n), as the least significant bit of n does not contribute to a(n). - Reinhard Zumkeller, Aug 17 2003, edited by A.H.M. Smeets, Aug 17 2019
a(n) = A029931(floor(n/2)). - Franklin T. Adams-Watters, Oct 22 2011
a(n) = Sum_{k=0..A070939(n)-1} k*A030308(n,k). - Reinhard Zumkeller, Jun 01 2013
Conjecture: a(n) = (3*A011371(n) - Sum_{k=1..n} A007814(k)^2)/2 for n > 0. - Velin Yanev, Sep 09 2017
G.f.: (1/(1 - x)) * Sum_{k>=1} k*x^(2^k)/(1 + x^(2^k)). - Ilya Gutkovskiy, Aug 17 2019
From A.H.M. Smeets, Aug 17 2019: (Start)
floor(log_2(n)) <= a(n) <= floor(log_2(n+2)*(log_2(n+2)-1)/2), n > 0.
Lower bound: floor(log_2(n)) = a(n) for n = 2^m or n = 2^m+1, m >= 0.
Upper bound: a(n) = floor(log_2(n+2)*(log_2(n+2)-1)/2) for n = 2^m-2 or n = 2^m-1, m >= 0. (End)
From Aayush Soni, Feb 12 2022: (Start)
For k < 2^n, a((2^n)+k) + a((2^n)-k-1) = n*(n+1)/2.
Proof: Any (n+1)-bit number 111...11_2 can only be split into two numbers 2^n + k and 2^n - k - 1 which never share any bits in common. Since a(111...11_2) = 0+1+2+...+n, this implies the stated formula. (End)

Extensions

a(0)=0 and offset corrected by Philippe Deléham, Apr 20 2009

A087135 Number of positive numbers m such that A073642(m) = n.

Original entry on oeis.org

1, 2, 2, 4, 4, 6, 8, 10, 12, 16, 20, 24, 30, 36, 44, 54, 64, 76, 92, 108, 128, 152, 178, 208, 244, 284, 330, 384, 444, 512, 592, 680, 780, 896, 1024, 1170, 1336, 1520, 1728, 1964, 2226, 2520, 2852, 3220, 3632, 4096, 4608, 5180, 5820, 6528, 7316, 8194, 9164, 10240, 11436, 12756, 14216, 15834
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 17 2003

Keywords

Comments

For n > 0, number of partitions of n into distinct nonnegative integers; for all n, number of nonempty partitions of n into distinct nonnegative integers. - Franklin T. Adams-Watters, Dec 28 2006
For n >= 1, a(n-1) is the number of partitions of n where all parts except possibly the two smallest are distinct, see example. - Joerg Arndt, May 23 2013

Examples

			n=6: numbers m such that A073642(m)=6: {14,15,20,21,34,35,64,65}, therefore a(6)=8.
From _Joerg Arndt_, May 23 2013: (Start)
There are a(10-1)=15 partitions of 10 where all parts except possibly the two smallest are distinct:
01:  [ 1 1 2 6 ]
02:  [ 1 1 3 5 ]
03:  [ 1 1 8 ]
04:  [ 1 2 3 4 ]
05:  [ 1 2 7 ]
06:  [ 1 3 6 ]
07:  [ 1 4 5 ]
08:  [ 1 9 ]
09:  [ 2 2 6 ]
10:  [ 2 3 5 ]
11:  [ 2 8 ]
12:  [ 3 3 4 ]
13:  [ 3 7 ]
14:  [ 4 6 ]
15:  [ 5 5 ]
16:  [ 10 ]
(End)
		

Crossrefs

Cf. A087136.

Programs

  • Maple
    ZL:=product(1+x^(j-1), j=1..59): gser:=series(ZL, x=0, 55): seq(coeff(gser, x, n), n=1..48); # Zerinvary Lajos, Mar 09 2007
  • Mathematica
    (QPochhammer[-1, x] - 1 + O[x]^58)[[3]] (* Vladimir Reshetnikov, Nov 20 2015 *)
  • PARI
    /* From the formula given by Joerg Arndt: */
    {a(n)=polcoeff(sum(m=0,n,x^(m*(m+1)/2)/prod(k=1,m+1,1-x^k +x*O(x^n))),n)}
    for(n=0,60,print1(a(n),", ")) /* Paul D. Hanna, Feb 19 2012 */
    
  • PARI
    {a(n)=polcoeff(sum(m=0,n,x^m*prod(k=0,m-1,1+x^k +x*O(x^n))),n)}
    for(n=0,60,print1(a(n),", ")) /* Paul D. Hanna, Feb 19 2012 */

Formula

a(n) = 2*A000009(n) for n>0.
G.f.: Sum_{n>=0} (x^(n*(n+1)/2) / Product_{k=1..n+1} (1-x^k ) ). - Joerg Arndt, Mar 24 2011
G.f.: Sum_{n>=0} x^n * Product_{k=0..n-1} (1+x^k). - Paul D. Hanna, Feb 19 2012

Extensions

Added "positive" to definition. - N. J. A. Sloane, Aug 25 2019
Showing 1-2 of 2 results.