OFFSET
0,3
LINKS
Paul Tek, Table of n, a(n) for n = 0..10000
FORMULA
a(0) = 0. a(2^n) = 4^n. a(4n+2) = (4n+2)*(1+a(4n+1)/(4n+1)).
a(n) =z(n, n) with z(u, v) = if u=0 then 0 else if u mod 2 = 0 then z(u/2, v)*2 else z([u/2], v)*A062383(v)+v. - Reinhard Zumkeller, Feb 15 2004
EXAMPLE
a(5): 5 = 101 -> (101)0(101) = 1010101 = 85.
MATHEMATICA
bss[n_]:=Module[{idn2=IntegerDigits[n, 2]}, FromDigits[Flatten[idn2/.{1-> idn2}], 2]]; Array[bss, 40, 0] (* Harvey P. Dale, Aug 15 2017 *)
PROG
(Python)
def a(n): b = bin(n)[2:]; return int(b.replace("1", b), 2)
print([a(n) for n in range(40)]) # Michael S. Branicky, Aug 05 2022
CROSSREFS
KEYWORD
base,easy,nonn
AUTHOR
Marc LeBrun, Oct 18 2001
EXTENSIONS
Name clarified by Michael S. Branicky, Aug 05 2022
STATUS
approved