is(n) = { my (b=binary(n)); for (w=1, #b, my (h=[]); for (o=1, #b+1-w, h=setunion(h, [vecsum(b[o..o+w-1])]); ); if (vecmax(h)-vecmin(h)>2, return (0); ); ); return (1); } vv = [0] nb = 1 mx = 2^14 visit(v) = { if (nb++ > #vv, vv=concat(vv, vector(#vv)); ); vv[nb] = v; if (2*v