big = 1 000 000 s = 0 S = Set([]) unseen = 1 seen(v) = if (v < big, bit test(s, v), set search(S, v)) see(v) = if (v < big, s = bit or(s, 2^v), S = set union(S, Set([v]))); while (seen(unseen), unseen++) other(p) = { for (v=unseen, oo, if (!seen(v) && isprime(bitxor(p,v)), return (v); ); ); } { pp = 0; p = 0; for (n=1, 10 000, if (n==1, v = 1, n==2, v = 2, v = other(bitxor(pp,p))); see(v); print (n " " v); pp = p; p = v; ); } quit