big = 1 000 000 s = 0 S = [] unseen = 1 seen(v) = if (v < big, bittest(s, v), setsearch(S, v)) see(v) = if (v < big, s = bitor(s, 2^v), S = setunion(S, [v])); while (seen(unseen), unseen++) { for (n = 1, 10 000, if (n <= 2, v2 = Mod(1, 2) * Pol(binary(v = n)), for (w = unseen, oo, if (!seen(w), w2 = Mod(1, 2) * Pol(binary(w)); if (gcd(v2, w2)!=1, [v, v2] = [w, w2]; break; ); ); ); ); see(v); print (n " " v); ); } quit