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.

A298011 If n = Sum_{i=1..h} 2^b_i with 0 <= b_1 < ... < b_h, then a(n) = Sum_{i=1..h} i * 2^b_i.

Original entry on oeis.org

0, 1, 2, 5, 4, 9, 10, 17, 8, 17, 18, 29, 20, 33, 34, 49, 16, 33, 34, 53, 36, 57, 58, 81, 40, 65, 66, 93, 68, 97, 98, 129, 32, 65, 66, 101, 68, 105, 106, 145, 72, 113, 114, 157, 116, 161, 162, 209, 80, 129, 130, 181, 132, 185, 186, 241, 136, 193, 194, 253, 196
Offset: 0

Views

Author

Rémy Sigrist, Jan 10 2018

Keywords

Comments

This sequence is similar to A298043.

Examples

			For n = 42:
- 42 = 2 + 8 + 32,
- hence a(42) = 1*2 + 2*8 + 3*32 = 114.
		

Crossrefs

Programs

  • Maple
    F[0]:= x -> x:
    for i from 1 to 8 do
      F[i]:= unapply(convert(series(2*(x+1)*F[i-1](x^2)+H, x, 2^(i+1)),
        polynom), x)
    od:
    seq(coeff(F[8](x),x,j),j=0..2^9-1); # Robert Israel, Jan 16 2018
  • Mathematica
    a[0] = 0; a[n_] := a[n] = If[OddQ[n], a[n - 1] + n, 2*a[n/2]]; Array[a, 100, 0] (* Amiram Eldar, Jul 24 2023 *)
  • PARI
    a(n) = my (b=binary(n), z=0); forstep (i=#b, 1, -1, if (b[i], b[i] = z++)); return (fromdigits(b, 2))
    
  • PARI
    first(n) = n += (n-1)%2; my(res = vector(n)); res[1]= 1; for(i = 1, n\2, res[2 * i] = 2 * res[i]; res[2 * i + 1] = res[2 * i] + 2*i + 1); concat([0], res) \\ David A. Corneth, Jan 14 2018

Formula

a(n) = Sum_{k = 0..A000120(n)-1} A129760^k(n) for any n > 0 (where A129760^k denotes the k-th iterate of A129760).
a(n) >= n with equality iff n = 0 or n = 2^k for some k >= 0.
a(2 * n) = 2 * a(n).
a(2^n - 1) = A000337(n).
a(2 * n + 1) = a(2 * n) + 2 * n + 1. David A. Corneth, Jan 14 2018
G.f. g(x) satisfies g(x) = 2*(x+1)*g(x^2) + x*(1+x^2)/(1-x^2)^2. - Robert Israel, Jan 16 2018