cmpf(x,y) = { if (x==y, return (0), for (b=2, oo, my (d=if (x, logint(x,b), -1)-if (y, logint(y,b), -1)); if (d, return ((-1)^b * d); ); ); ); } { a = vecsort([1..2^13-1], cmpf); \\ A360959 b = vector(#a); \\ inverse for (k=1, #a, b[a[k]] = k; ); print ("0 0"); for (n=1, #b, print (n " " b[n]); ); } quit