children = vector(5 000, n, []) { m = 1; for (n=2, #children, r = binomial(n); rr = binomial(n+1); for (k=2, #r-1, c = r[k]; if (c > #children, break, children[c] = setunion(children[c], Set([rr[k], rr[k+1]])); ); ); apply (v -> print (m++ " " v), children[n]); ); } quit