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++) { m = [0]; for (n = 1, 2500, nb = 1; fordiv (n, d, if (#m < 2*nb, m = concat(m, vector(#m)); ); for (j = 1, nb, v = m[nb + j] = m[j] + 2^(d-1); if (!seen(v), see(v); print (n " " v); break (2); ); ); nb *= 2; ); ); } quit