f(n) = { my (t=[0]); forprime (p=2, oo, if (n==0, return (vecsort(select(sign, t))), my (d=n%p); while (1+d>#t, t=concat(t, vector(#t)); ); t[1+d]++; n\=p; ); ); } mx = vecprod(primes(5))-1 ff = Set(apply(f, [1..mx])) vv = vector(#ff, m, [0]) nb = vector(#ff) for (n=1, mx, m=setsearch(ff,f(n)); if (nb[m]++>#vv[m], vv[m]=concat(vv[m], vector(#vv[m]))); vv[m][nb[m]]=n) print ("0 0"); for (n=1, mx, m=setsearch(ff,f(n)); print (n " " vv[m][nb[m]]); nb[m]--) quit