s = 0 unseen = 1 seen(v) = bit test(s, v) see(v) = s = bit or(s, 2^v); while (seen(unseen), unseen++) other(p) = { see(p); for (v=unseen, oo, if (!seen(v) && hammingweight(bitand(p,v))%2==0, return (v); ); ); } for (n=1, 10 000, print (n " " v=if (n==1, 1, other(v)))) quit