login
A161134
Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} having exactly k even fixed points (0 <= k <= floor(n/2)).
2
1, 1, 1, 1, 4, 2, 14, 8, 2, 78, 36, 6, 426, 234, 54, 6, 3216, 1512, 288, 24, 24024, 12864, 3024, 384, 24, 229080, 108960, 22320, 2400, 120, 2170680, 1145400, 272400, 37200, 3000, 120, 25022880, 11998800, 2563200, 309600, 21600, 720, 287250480
OFFSET
0,5
COMMENTS
Row n contains 1 + floor(n/2) entries.
Sum of row n is n! = A000142(n).
T(n,0) = A161132(n).
Sum_{k>=0} k*T(n,k) = A052591(n-1).
LINKS
Indranil Ghosh, Rows 0..125, flattened
FORMULA
T(n,k) = binomial(floor(n/2), k)*Sum_{j=0..floor(n/2)-k}(-1)^j*(n-k-j)!*binomial(floor(n/2)-k, j).
EXAMPLE
T(3,0)=4 because we have 132, 312, 213, 231; T(3,1)=2 because we have 123 and 321.
Triangle starts:
1;
1;
1, 1;
4, 2;
14, 8, 2;
78, 36, 6;
426, 234, 54, 6;
MAPLE
T := proc (n, k) options operator, arrow: binomial(floor((1/2)*n), k)*add((-1)^j*binomial(floor((1/2)*n)-k, j)*factorial(n-k-j), j = 0 .. floor((1/2)*n)-k) end proc: for n from 0 to 12 do seq(T(n, k), k = 0 .. floor((1/2)*n)) end do; # yields sequence in triangular form
MATHEMATICA
Flatten[Table[Binomial[Floor[n/2], k]*Sum[(-1)^j*(n - k - j)!*Binomial[Floor[n/2] - k, j], {j, 0, Floor[n/2] - k}], {n, 0, 12}, {k, 0, Floor[n/2]}]] (* Indranil Ghosh, Mar 08 2017 *)
PROG
(PARI) tabf(nn) = { for(n=0, nn, for(k = 0, floor(n/2), print1(binomial(floor(n/2), k) * sum(j=0, floor(n/2) - k, (-1)^j*(n - k - j)! * binomial(floor(n/2) - k, j)), ", "); ); print(); ); };
tabf(12); \\ Indranil Ghosh, Mar 08 2017
(Python)
from sympy import factorial, binomial
def T(n, k):
s=0
for j in range(n//2 - k+1):
s+=(-1)**j * factorial(n-k-j) * binomial(n//2 - k, j)
return binomial(n//2, k)* s
i=0
for n in range(26):
for k in range(n//2 + 1):
print(str(i)+" "+str(T(n, k)))
i+=1
# Indranil Ghosh, Mar 08 2017
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Emeric Deutsch, Jul 18 2009
STATUS
approved