big = 1 000 000 s = 0 S = [] unseen = 0 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++) { print ("0 0"); a = vector(10 000); u = 1; for (n = 0, oo, if (n==0, v = 0, (unseen + v) % n==0, v = unseen, forstep (w = ((-v)%n) + (unseen\n)*n, oo, n, if (!seen(w) && (w + unseen) % (n+1)==0, v = w; break; ); ); ); see(v); if (v && v<=#a, a[v] = n; while (a[u], print (u " " a[u]); if (u++ > #a, break (2); ); ); ); ); } quit