big = 1 000 000 s = 0 S = Set([]) unseen = 0 seen(v) = if (v < big, bit test(s, v), set search(S, v)) see(v) = if (v < big, s = bit or(s, 2^v), S = set union(S, Set([v]))); while (seen(unseen), unseen++) \\ least k unseen / v AND k = 0 cc = [0] avoid(v) = { if (!seen(0), return (0); ); my (b, c, nb=1); for (e=0, oo, if (!bittest(v,e), if (nb==#cc, cc=concat(cc, vector(#cc)); ); b=2^e; for (k=1, nb, c = cc[nb+k] = cc[k]+b; if (!seen(c), return (c); ); ); nb*=2; ); ); } { m=0; for (n=1, 141, x = 0; for (k=1, n, see(v = avoid(x)); print (m++ " " v); x += v; ); ); } quit