allocate mem(2^30) { nb = [0, 0]; uu = [0, 0]; vv = [0, 0]; a = vector(10 000); for (n=1, #a, if (n==1, v=1, n==2, v=2, while (nb[v++]!=1, ); ); print (n " " vv[v]); a[n] = v; for (k=1, n-1, s=a[k]+a[n]; while (#nb < s, nb = concat(nb, vector(#nb)); uu = concat(uu, vector(#uu)); vv = concat(vv, vector(#vv)); ); nb[s]++; uu[s]=k; vv[s]=n; ); ); } quit