tr(v)=if (v>=0, 1+2*v, -2*v) ord = [0] { z = 0; \\ wanted v = 0; for (n = 0, oo, if (v==z, print (z " " n); if (z==10 000, break, z++ ); ); w = tr(v); while (#ord < w, ord = concat(ord, vector(#ord)); ); k = ord[w]++; e = v > 0; v += (-1)^(k+e)*(k\2); ); }