\\ A067138 T(n,k) = { my (v=0, e); while (k, k-=2^e=valuation(k, 2); v=bitor(v, n*2^e); ); v } vv = vector(2^10, n, []) { for (n=1, #vv, for (k=1, oo, v = T(n,k); if (v>#vv, break, vv[v]=setunion(vv[v], [n])); ); ); } apply (v -> print (n++ " " v), concat(vv)); quit