A374355 a(n) is the least fibbinary number f <= n such that n - f is also a fibbinary number whose binary expansion has no common 1's with that of f (where fibbinary numbers correspond to A003714).
0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 0, 0, 0, 1, 0, 0, 2, 2, 8, 8, 8, 9, 8, 8, 10, 10, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 16, 16, 16, 17, 16, 16, 18, 18, 16, 16, 16, 17, 20, 20, 20, 21, 0, 0, 0, 1, 0, 0, 2, 2, 0, 0, 0, 1, 4, 4, 4, 5, 0
Offset: 0
Examples
The first terms, in binary and in decimal, are: n a(n) bin(n) bin(a(n)) -- ---- ------ --------- 0 0 0 0 1 0 1 0 2 0 10 0 3 1 11 1 4 0 100 0 5 0 101 0 6 2 110 10 7 2 111 10 8 0 1000 0 9 0 1001 0 10 0 1010 0 11 1 1011 1 12 4 1100 100 13 4 1101 100 14 4 1110 100 15 5 1111 101 16 0 10000 0
Links
Programs
-
PARI
a(n) = { my (v = 0, e, x, y, b); while (n, x = y = 0; e = valuation(n, 2); for (k = 0, oo, if (bittest(n, e+k), n -= b = 2^(e+k); [x, y] = [y + b, x], v += y; break;););); return (v); }
Comments