s = 0 unseen = 0 seen(v) = bit test(s, v) see(v) = s = bit or(s, 2^v); while (seen(unseen), unseen++) tozeck(n) = { for (i=0, oo, if (n<=fibonacci(2+i), my (v=0, f); forstep (j=i, 0, -1, if (n>=f=fibonacci(2+j), n-=f; v+=2^j; ); if (n==0, return (v); ); ); ); ); } cache = apply(tozeck, [0..8360]) other(p) = { my (pp=cache[p+1]); for (v=unseen, oo, if (!seen(v) && bitand(pp, cache[v+1])==0, return (v); ); ); } for (n=0, 8360, see(v=other(n)); print (n " " v)) quit