OFFSET
0,3
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
a(0)=0, a(2n) = 4a(n) + 2, a(2n+1) = 2a(n) + 1.
EXAMPLE
n=9: 1001 -> 110101 = 53, so a(9) = 53.
MATHEMATICA
Join[{0}, Table[FromDigits[Flatten[IntegerDigits[n, 2]/.(0->{1, 0})], 2], {n, 80}]] (* Harvey P. Dale, Dec 05 2023 *)
PROG
(PARI) a(n)=if(n<1, 0, if(n%2==0, 4*a(n/2)+2, 2*a((n-1)/2)+1))
CROSSREFS
KEYWORD
nonn,easy,base
AUTHOR
Ralf Stephan, Oct 07 2003
STATUS
approved