login
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).
5

%I #11 Jul 09 2024 02:21:30

%S 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,

%T 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,

%U 20,20,21,0,0,0,1,0,0,2,2,0,0,0,1,4,4,4,5,0

%N 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).

%C To compute a(n): replace every other bit with zero (starting with the first bit) in each run of consecutive 1's in the binary expansion of n.

%H Rémy Sigrist, <a href="/A374355/b374355.txt">Table of n, a(n) for n = 0..8191</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = A374354(n, 0).

%F a(n) = n - A374356(n).

%F a(n) >= 0 with equality iff n is a fibbinary number.

%e The first terms, in binary and in decimal, are:

%e n a(n) bin(n) bin(a(n))

%e -- ---- ------ ---------

%e 0 0 0 0

%e 1 0 1 0

%e 2 0 10 0

%e 3 1 11 1

%e 4 0 100 0

%e 5 0 101 0

%e 6 2 110 10

%e 7 2 111 10

%e 8 0 1000 0

%e 9 0 1001 0

%e 10 0 1010 0

%e 11 1 1011 1

%e 12 4 1100 100

%e 13 4 1101 100

%e 14 4 1110 100

%e 15 5 1111 101

%e 16 0 10000 0

%o (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); }

%Y Cf. A003714, A374354, A374356.

%K nonn,base

%O 0,7

%A _Rémy Sigrist_, Jul 06 2024