function combinations(n,k) { a = J(comb(n,k),k,.) u = 1..k for (i=1; 1; i++) { a[i,.] = u for (j=k; j>0; j--) { if (u[j]-j