%I #11 Jul 09 2024 02:21:22
%S 0,1,2,2,4,5,4,5,8,9,10,10,8,9,10,10,16,17,18,18,20,21,20,21,16,17,18,
%T 18,20,21,20,21,32,33,34,34,36,37,36,37,40,41,42,42,40,41,42,42,32,33,
%U 34,34,36,37,36,37,40,41,42,42,40,41,42,42,64,65,66,66
%N a(n) is the greatest 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 second bit) in each run of consecutive 1's in the binary expansion of n.
%H Rémy Sigrist, <a href="/A374356/b374356.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, A277561(n)-1).
%F a(n) = n - A374355(n).
%F a(n) <= n with equality iff n is a fibbinary number.
%e The first terms, in decimal and in binary, are:
%e n a(n) bin(n) bin(a(n))
%e -- ---- ------ ---------
%e 0 0 0 0
%e 1 1 1 1
%e 2 2 10 10
%e 3 2 11 10
%e 4 4 100 100
%e 5 5 101 101
%e 6 4 110 100
%e 7 5 111 101
%e 8 8 1000 1000
%e 9 9 1001 1001
%e 10 10 1010 1010
%e 11 10 1011 1010
%e 12 8 1100 1000
%e 13 9 1101 1001
%e 14 10 1110 1010
%e 15 10 1111 1010
%e 16 16 10000 10000
%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 += x; break;););); return (v); }
%Y Cf. A003714, A277561, A374354, A374355.
%K nonn,base
%O 0,3
%A _Rémy Sigrist_, Jul 06 2024