OFFSET
1,2
LINKS
Alois P. Heinz, Rows n = 0..24, flattened
EXAMPLE
T(7,3) = 5: {2,3,4,5,7}-> 25/34/7, {1,3,4,6,7}-> 16/34/7, {1,2,5,6,7}-> 16/25/7, {1,2,3,5,6,7}-> 17/26/35, {2,3,4,5,6,7}-> 27/36/45.
T(8,4) = 2: {1,2,3,5,6,7,8}-> 17/26/35/8, {1,2,3,4,5,6,7,8}-> 18/27/36/45.
T(9,5) = 1: {1,2,3,5,6,7,8,9}-> 18/27/36/45/9.
Triangle T(n,k) begins:
01 : 1;
02 : 2;
03 : 4, 1;
04 : 8, 2;
05 : 16, 4, 1;
06 : 32, 10, 2;
07 : 64, 20, 5, 1;
08 : 128, 44, 12, 2;
09 : 256, 93, 29, 6, 1;
10 : 512, 198, 63, 14, 2;
11 : 1024, 414, 146, 37, 7, 1;
12 : 2048, 864, 329, 88, 16, 2;
MAPLE
b:= proc(l, i) option remember; local k, r, j;
k, r:= nops(l), {};
if i*(i+1)/2 < l[-1]*k-add(j, j=l) then r
elif i=0 then {r}
else for j to k do r:= r union map(y->y union {i}, b((p->
map(x->x-p[1], p))(sort(subsop(j=l[j]+i, l))), i-1))
od;
r union b(l, i-1)
fi
end:
A:= (n, k)-> `if`(k=1, 2^(n-1), nops(b([0$(k-1), n], n-1))):
seq(seq(A(n, k), k=1..iquo(n+1, 2)), n=1..15);
MATHEMATICA
b[l_, i_] := b[l, i] = Module[{k, r, j}, {k, r} = {Length[l], {}}; Which[ i*(i+1)/2 < l[[-1]]*k - Total[l], r, i == 0, {r}, True, For[j = 1, j <= k, j++, r = r ~Union~ Map[# ~Union~ {i}&, b[Function[p, Map[#-p[[1]]&, p] ][Sort[ReplacePart[l, j -> l[[j]]+i]]], i-1]]]; r ~Union~ b[l, i-1]]]; A[n_, k_] := If[k==1, 2^(n-1), Length[b[Append[Array[0&, (k-1)], n], n-1] ]]; Table[A[n, k], {n, 1, 15}, {k, 1, Quotient[n+1, 2]}] // Flatten (* Jean-François Alcover, Feb 03 2017, Translated from Maple *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Alois P. Heinz, Oct 01 2014
STATUS
approved