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(x) = { for (v = unseen, oo, if (!seen(v) && gcd(x, v)==1, return (v); ); ); } { my (u = vector(141, d, 1)); my (v = vector(#u, d, 1)); my (m = 0); for (n = 1, #u, my (r = 1); for (k = 1, n, a = other(r * u[k] * v[n+1-k]); see(a); r *= a; u[k] *= a; v[n+1-k] *= a; print (m++ " " a); ); ); } quit