big = 1 000 000 s = 0 S = Set([]) unseen = 1 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++) other(p) = { forstep (m=2*p, oo, p, if (!seen(m), return (m); ); ); } n=0 a = vector(2^13) emit(v) = { see(v); print (n++ " " a[n]=v); } { emit(1); while (n<#a, w=n; forstep (k=w, 1, -1, emit(other(a[k])); ); ); } quit