OFFSET
0,2
LINKS
Rémy Sigrist, Table of n, a(n) for n = 0..8192
FORMULA
a(0)=0, a(2n) = 2a(n), a(2n+1) = 4a(n) + 3.
EXAMPLE
n=9: 1001 -> 110011 = 51, so a(9) = 51.
PROG
(PARI) a(n)=if(n<1, 0, if(n%2==0, 2*a(n/2), 4*a((n-1)/2)+3))
(Python)
def a(n): return int(bin(n)[2:].replace('1', '11'), 2)
print([a(n) for n in range(55)]) # Michael S. Branicky, Feb 20 2021
CROSSREFS
Ordered terms plus one are in A048297.
KEYWORD
nonn,easy,base
AUTHOR
Ralf Stephan, Oct 07 2003
STATUS
approved