s = 0 unseen = 1 seen(v) = bit test(s, v) see(v) = s = bit or(s, 2^v); while (seen(unseen), unseen++) n=-1 emit(v) = { print (n++ " " v); if (n==10 000, quit, see(v) ) } \\ n-th term without common bit with x avoid(x,n) = { my (v=0, b=1); while (n, if (x%2==0, if (n%2, v+=b; ); n\=2 ); x\=2; b*=2; ); v } { v=0; while (1, emit(v); if (bitand(v, unseen)==0, v=unseen, x = bitor(v,unseen); for (i=0, oo, c=avoid(x,i); if (!seen(c), emit(c); v=unseen; break; ); ); ); ); } quit