n = 0 nb = [0] get(m) = if (1+m <= #nb, nb[1+m], 0) emit(v, show) = { if (show, print (n++ " " v); ); while (1+v > #nb, nb = concat(nb, vector(#nb)); ); nb[1+v]++; } { while (n < 10 000, for (m=0, oo, my (k=get(m)); emit(k, 1); emit(m, 0); if (k==0, break; ); ); ); } quit