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