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++) a = vector(141) n = 0 emit(v) = { see(v); print (n++ " " v); if (n <= #a, a[n] = v; ); } other(p) = { forstep (v = ceil(unseen/p)*p, oo, p, if (!seen(v), return (v); ); ); } { emit(unseen); for (n = 2, #a, for (k = 1, n, emit(other(a[k])); ); ); } quit