A138770 Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} such that there are exactly k entries between the entries 1 and 2 (n>=2, 0<=k<=n-2).
2, 4, 2, 12, 8, 4, 48, 36, 24, 12, 240, 192, 144, 96, 48, 1440, 1200, 960, 720, 480, 240, 10080, 8640, 7200, 5760, 4320, 2880, 1440, 80640, 70560, 60480, 50400, 40320, 30240, 20160, 10080, 725760, 645120, 564480, 483840, 403200, 322560, 241920, 161280, 80640
Offset: 2
Examples
T(4,2)=4 because we have 1342, 1432, 2341 and 2431. Triangle starts: 2; 4,2; 12,8,4; 48,36,24,12; 240,192,144,96,48; ...
Programs
-
Maple
T:=proc(n,k) if n-2 < k then 0 else (2*n-2*k-2)*factorial(n-2) end if end proc; for n from 2 to 10 do seq(T(n, k),k=0..n-2) end do; # yields sequence in triangular form
-
Mathematica
Table[Table[2 (n - r) (n - 2)!, {r, 1, n - 1}], {n, 1, 10}] // Grid (* Geoffrey Critzer, Dec 19 2009 *)
Comments