a = vector(10 000) \\ A124145 nb = vector(30 000) w = vector(#nb) { for (n=1, #a, if (n==1, v=1, n==2, v=2, while (nb[v++]!=1, ) ); a[n] = v; if (n>2, print (n " " w[v]); ); s = 0; forstep (k=n, 1, -1, s+=a[k]; if (s>#nb, break, nb[s]++; w[s]=n-k+1 ); ); ); } quit