A334667 For any number with binary expansion (b_1, ..., b_w), replace the i-th "1" by b_{w+1-i} for i = 1..A000120(n) and the j-th "0" by b_j for j = 1..A023416(n); the resulting binary expansion is that of a(n).
0, 1, 1, 3, 2, 6, 3, 7, 4, 12, 6, 14, 3, 11, 7, 15, 8, 24, 10, 26, 9, 25, 14, 30, 6, 22, 13, 29, 7, 23, 15, 31, 16, 48, 18, 50, 17, 49, 22, 54, 18, 50, 25, 57, 21, 53, 30, 62, 12, 44, 28, 60, 14, 46, 29, 61, 7, 39, 23, 55, 15, 47, 31, 63, 32, 96, 34, 98, 33
Offset: 0
Examples
For n = 41: - the binary representation of 41 is "101001", - the 3 1's are replaced by 1, 0, 0, respectively, - the 3 0's are replaced by 1, 0, 1, respectively, - hence we obtain "110010", - and a(41) = 50.
Links
Programs
-
PARI
a(n) = { my (b=binary(n), t=vector(#b), l=0, r=#b+1); for (k=1, #b, t[k] = if (!b[k], b[l++], b[r--])); fromdigits(t, 2) }
Comments