\\ A374356 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). b(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); } { mx = 2^13-1; vv = vector(mx, n, []); for (n = 1, mx, v = b(n); vv[v] = concat(vv[v], n); ); a = vector(mx); for (n = 1, #vv, for (k = 1, #vv[n], a[vv[n][k]] = vv[n][#vv[n]+1-k]; ); ); print ("0 0"); for (n = 1, #a, print (n " " a[n]); ); } quit