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