OFFSET
0,3
COMMENTS
Or, first differences of A003071. - Zak Seidov, Dec 28 2011
FORMULA
For n > 0: a(n) = A003071(n) - A003071(n - 1) = A006519(n) + A000120(n) - 1. If n is a power of 2 then a(n) = n, otherwise a(n) = a(A053645(n)) + 1 where A053645(n) = n - 2^floor(log_2(n)) is the amount by which n exceeds a power of 2.
G.f.: x/(1-x)^2 + (1/(1-x))*Sum_{k>=1} (-1 + (1-x)*2^(k-1))*x^2^k/(1-x^2^k). - Ralf Stephan, Apr 17 2003
MATHEMATICA
nn=100; s={1}; m = Ceiling[Log[2, nn]]; Do[s=Join[s, {2^n}, s+1], {n, m}]; Prepend[Take[s, nn], 0] (* Zak Seidov, Dec 28 2011 *)
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Henry Bottomley, Apr 27 2001
STATUS
approved