OFFSET
0,8
LINKS
Alois P. Heinz, Rows n = 0..50, flattened
Wikipedia, Permutation
FORMULA
EXAMPLE
T(3,0) = 2: 231, 312.
T(3,1) = 1: 132.
T(3,2) = 1: 321.
T(3,3) = 1: 213.
T(3,6) = 1: 123.
T(4,0) = 9: 2143, 2341, 2413, 3142, 3412, 3421, 4123, 4312, 4321.
Triangle T(n,k) begins:
1;
0, 1;
1, 0, 0, 1;
2, 1, 1, 1, 0, 0, 1;
9, 2, 2, 3, 3, 2, 1, 1, 0, 0, 1;
44, 9, 9, 11, 11, 13, 5, 5, 4, 4, 2, 1, 1, 0, 0, 1;
...
MAPLE
b:= proc(s) option remember; (n-> `if`(n=0, 1, add(expand(
`if`(j=n, x^j, 1)*b(s minus {j})), j=s)))(nops(s))
end:
T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b({$1..n})):
seq(T(n), n=0..7);
# second Maple program:
g:= proc(n) option remember; `if`(n=0, 1, n*g(n-1)+(-1)^n) end:
b:= proc(n, i, m) option remember; `if`(n>i*(i+1)/2, 0,
`if`(n=0, g(m), b(n, i-1, m)+b(n-i, min(n-i, i-1), m-1)))
end:
T:= (n, k)-> b(k, min(n, k), n):
seq(seq(T(n, k), k=0..n*(n+1)/2), n=0..7);
MATHEMATICA
g[n_] := g[n] = If[n == 0, 1, n*g[n - 1] + (-1)^n];
b[n_, i_, m_] := b[n, i, m] = If[n > i*(i + 1)/2, 0,
If[n == 0, g[m], b[n, i-1, m] + b[n-i, Min[n-i, i-1], m-1]]];
T[n_, k_] := b[k, Min[n, k], n];
Table[Table[T[n, k], {k, 0, n*(n + 1)/2}], {n, 0, 7}] // Flatten (* Jean-François Alcover, May 24 2024, after Alois P. Heinz *)
CROSSREFS
Column k=0 gives A000166.
Column k=3 gives A000255(n-2) for n>=2.
Row sums give A000142.
Row lengths give A000124.
Reversed rows converge to A331518.
T(n,n) gives A369796.
KEYWORD
nonn,tabf
AUTHOR
Alois P. Heinz, Mar 02 2024
STATUS
approved