OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
FORMULA
a(1)=1, a(2*k+1)=2*a(k)+1, a(2*k)=4*a(k).
MAPLE
a:= n-> Bits[Join](subs(0=[0$2][], Bits[Split](n))):
seq(a(n), n=1..60); # Alois P. Heinz, Jan 15 2021
MATHEMATICA
f[n_] := FromDigits[Flatten[IntegerDigits[n, 2] /. {0 -> {0, 0}}], 2]; Array[f, 60] (* Robert G. Wilson v, Dec 10 2009 *)
PROG
(Haskell)
a084471 1 = 1
a084471 x = 2 * (2 - d) * a084471 x' + d where (x', d) = divMod x 2
-- Reinhard Zumkeller, Jul 16 2012
CROSSREFS
KEYWORD
AUTHOR
Reinhard Zumkeller, May 27 2003
STATUS
approved