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(10 000); u = 1; m = 0; b = [0]; for (d = 1, oo, for (k = 1, d, n = d+1-k; i = k; if (i > #b, b = concat(b, vector(#b)); ); if (b[i]==0, b[i] = unseen; ); while (seen(b[i]), b[i] += i; ); see(b[i]); m++; if (b[i] <= #a, a[b[i]] = m; while (a[u], print (u " " a[u]); if (u++ > #a, break (3); ); ); ); ); ); } quit