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.

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

A083741 a(n) = L(n) + a(L(n)), where L(n) = n - 2^floor(log_2(n)) (A053645).

Original entry on oeis.org

0, 0, 0, 1, 0, 1, 2, 4, 0, 1, 2, 4, 4, 6, 8, 11, 0, 1, 2, 4, 4, 6, 8, 11, 8, 10, 12, 15, 16, 19, 22, 26, 0, 1, 2, 4, 4, 6, 8, 11, 8, 10, 12, 15, 16, 19, 22, 26, 16, 18, 20, 23, 24, 27, 30, 34, 32, 35, 38, 42, 44, 48, 52, 57, 0, 1, 2, 4, 4, 6, 8, 11, 8, 10, 12, 15, 16, 19, 22, 26, 16, 18, 20
Offset: 0

Views

Author

Ralf Stephan, May 05 2003

Keywords

Comments

a(2^j)=0. Local extrema are a(2^j-1) = 2^j-j-1 (A000295).

Crossrefs

Programs

  • Mathematica
    f[l_]:=Join[l,l-1+Range[Length[l]]]; Nest[f,{0},7] (* Ray Chandler, Jun 01 2010 *)
  • PARI
    a(n)=if(n<2,0,if(n%2==0,2*a(n/2),if(n%4==1,2*a((n-1)/4)+a((n+1)/ 2),-2*a((n-3)/4)+3*a((n-3)/2+1)+1)))
    
  • PARI
    a(n) = my(v=binary(n),c=-1); for(i=1,#v, if(v[i],v[i]=c++)); fromdigits(v,2); \\ Kevin Ryde, Apr 16 2024

Formula

a(0)=0, a(1)=0, a(2n)=2a(n), a(4n+1)=2a(n)+a(2n+1), a(4n+3)=-2a(n)+3a(2n+1)+1.
a(n) = Sum_{i=0..k} i*2^e[i] where the binary expansion of n is n = Sum_{i=0..k} 2^e[i] with decreasing exponents e[0] > ... > e[k] (A272011). - Kevin Ryde, Apr 16 2024

Extensions

Extended by Ray Chandler, Mar 04 2010
Showing 1-2 of 2 results.