login
A065159
Binary string self-substitutions: a(n) is obtained by substituting the binary expansion of n for each 1-bit in the binary expansion of n.
4
0, 1, 4, 15, 16, 85, 108, 511, 64, 585, 660, 5819, 816, 7085, 7644, 65535, 256, 4369, 4644, 78451, 5200, 87381, 91564, 1531639, 6336, 105625, 109876, 1825659, 118384, 1961821, 2029500, 33554431, 1024, 33825, 34884, 1149155, 37008, 1217189, 1250124, 41056743
OFFSET
0,3
FORMULA
a(0) = 0. a(2^n) = 4^n. a(4n+2) = (4n+2)*(1+a(4n+1)/(4n+1)).
a(n) = A065157(n,n) = A065158(n,n)*n = A065160(n)*n.
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