| MATHEMATICA
|
f[A_]:=
(AAA={};
For [ii=1, ii<=Length[A], ii++,
For[jj=1, jj<=Length[A], jj++,
For [kk=1, kk<=Length[A], kk++,
AAA=Union[AAA, {A[[ii]]+A[[jj]]+A[[kk]]}]]]];
For[ii=1, ii<=Length[AAA], ii++,
If[ii==Length[AAA], max=ii-1];
If[AAA[[ii]]>ii-1, max=ii-2; Break[]]]);
index=1;
seq[1]={0, 1};
rindex=1;
newindex=1;
For[k=1, k<=5, k++,
jbegin=rindex; jend=index;
For[j=jbegin, j<=jend, j++,
f[seq[j]];
For[i=Max[seq[j]]+1, i<=max+1, i++, index++; seq[index]=Append[seq[rindex], i]
]; rindex=rindex+1;
]]
For[i=1, i<=index, i++, Print[i, " ", seq[i]]]
|