s = 0 unseen = 1 seen(v) = bit test(s, v) see(v) = s = bit or(s, 2^v); while (seen(unseen), unseen++) ok(v) = #binary(v)==2*hammingweight(v) other(n) = { for (v=unseen, oo, if (!seen(v), if (ok(n*v), see(v); return (v); ); ); ); } for (n=1, 10 000, print (n " " other(n))) quit