OFFSET
0,3
COMMENTS
LINKS
Alois P. Heinz, Rows n = 0..20, flattened
EXAMPLE
T(5,3) = 4 because we have 12354 (containing 123, 234, 135), 21345 (containing 234, 345, and 135), and their reversals 45321 and 54312.
Triangle starts:
1;
1;
2;
4, 2;
10, 12, 2;
20, 48, 46, 4, 2;
48, 156, 318, 152, 40, 4, 2;
...
MAPLE
n := 7: with(combinat): P := permute(n): st := proc (p) local ct, i, j, k: ct := 0: for i to nops(p)-2 do for j from i+1 to nops(p)-1 do for k from j+1 to nops(p) do if p[i]+p[k] = 2*p[j] then ct := ct+1 else end if end do end do end do; ct end proc: sort(add(t^st(P[i]), i = 1 .. factorial(n))); # yields the generating polynomial of row n
MATHEMATICA
row[n_] := CoefficientList[P = Permutations[Range[n]]; st[p_List] := Module[{ct = 0, i, j, k}, For[i = 1, i <= Length[p]-2, i++, For[j = i+1, j <= Length[p]-1, j++, For[k = j+1, k <= Length[p], k++, If[p[[i]] + p[[k]] == 2*p[[j]], ct = ct+1]]]]; ct]; Sum[t^st[P[[i]]], {i, 1, n!}], t];
Table[ro = row[n]; Print[ro]; ro, {n, 0, 9}] // Flatten (* Jean-François Alcover, Sep 08 2017, adapted from Maple *)
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Emeric Deutsch, Aug 31 2009
STATUS
approved