OFFSET
2,1
LINKS
Andrew Woods, Rows n = 2..101 of triangle, flattened
FORMULA
Sum_{k=n+1..2*n-1} T(n,k) = n! = A000142(n).
T(n,2*n-1) = 2*(n-1)! = A052849(n-1).
From Andrew Woods, Jun 16 2013: (Start)
T(n, even k) = (k-n)*T(n-1,k-1);
T(n, odd k) = (k-n+1)*T(n-1,k-1)+2*sum(T(n-1,i) for i=n..k-2);
T(n,2*n-1) = 2*(n-1)!;
T(n,2*n-2) = 2*(n-1)!-2*(n-2)! for n>2;
T(n,2*n-3) = 4*(n-1)!-12*(n-2)!+4*(n-3)! for n>3;
T(n,2*n-4) = 4*(n-1)!-24*(n-2)!+28*(n-3)!-4*(n-4)! for n>4;
T(n,2*n-5) = 6*(n-1)!-60*(n-2)!+152*(n-3)!-96*(n-4)!+8*(n-5)! for n>5.
(End)
EXAMPLE
For n=3 we have:
T(3,4)=2 with the permutations {312, 213} and
T(3,5)=4 with {123, 321, 132, 231}.
MATHEMATICA
T[n_ /; n >= 2, k_] /; n+1 <= k <= 2n-1 := T[n, k] = If[EvenQ[k], (k-n)* T[n-1, k-1], (k-n+1)*T[n-1, k-1] + 2*Sum[T[n-1, i], {i, n, k-2}]];
T[1, 2] = 1; T[_, _] = 0;
Table[T[n, k], {n, 2, 10}, {k, n+1, 2n-1}] // Flatten (* Jean-François Alcover, Jul 19 2022 *)
PROG
(Python)
# Generate n-th row (n>1) by checking all n! permutations
from itertools import permutations
def onerow(n):
..row=[0]*(n-1)
..for i in permutations(range(1, n+1)):
....row[max([j[0]+j[1] for j in zip(i, i[1:])])-n-1]+=1
..return row
# OR: Generate first twenty rows using recurrence
rows=[[2]]; row=[2]
for i in range(19):
..row=[(row[j]*(j+2)+sum(row[:j])*2) if (i+j)%2==1 else row[j]*(j+1) for j in range(i+1)]+[row[-1]*(i+2)]
..rows.append(row)
# Andrew Woods, Jun 18 2013
CROSSREFS
KEYWORD
AUTHOR
Klaus Strassburger (strass(AT)ddfi.uni-duesseldorf.de), Oct 05 2001
EXTENSIONS
More terms from Naohiro Nomoto, Nov 26 2001
STATUS
approved