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.

A135586 a(1)=0; for n >= 1, a(2n)=a(n)+2^A000120(n)-1, a(2n+1)=2a(2n).

Original entry on oeis.org

0, 1, 2, 2, 4, 5, 10, 3, 6, 7, 14, 8, 16, 17, 34, 4, 8, 9, 18, 10, 20, 21, 42, 11, 22, 23, 46, 24, 48, 49, 98, 5, 10, 11, 22, 12, 24, 25, 50, 13, 26, 27, 54, 28, 56, 57, 114, 14, 28, 29, 58, 30, 60, 61, 122, 31, 62, 63, 126, 64, 128, 129, 258, 6, 12, 13, 26, 14, 28, 29, 58, 15, 30
Offset: 1

Views

Author

Don Knuth, Mar 01 2008

Keywords

Crossrefs

Programs

  • Maple
    b:=proc(n)if n=0 then 0 elif `mod`(n,2)=0 then b((1/2)*n) else b((1/2)*n-1/2)+1 end if end proc: a:=proc(n) if n=1 then 0 elif `mod`(n, 2)=0 then a((1/2)*n)+2^b(n)-1 else 2*a(n-1) end if end proc: seq(a(n),n=1..60); # Emeric Deutsch, Mar 02 2008
  • Mathematica
    a = {0}; For[n = 2, n < 80, n++, If[OddQ[n], AppendTo[a, 2*a[[ -1]]], AppendTo[a, a[[n/2]] + 2^Length[Select[IntegerDigits[n/2, 2], # == 1 &]] - 1]]]; a (* Stefan Steinerberger, Mar 02 2008 *)

Formula

If n=2^{e_{k-1}}+ ... +2^{e_1}+2^{e_0}, where k=A000120(n) and e_{k-1}> ... >e_1>e_0, then a(n)=e_0+2e_1+ ... +2^{k-1}e_{k-1}.
a(2^k) = k; a(4*k+2) = a(4*k+1) + 1; a(4*k+3) = 2*a(4*k+2). - Reinhard Zumkeller, Mar 02 2008

Extensions

More terms from Reinhard Zumkeller, Emeric Deutsch and Stefan Steinerberger, Mar 02 2008