login
A152878
Triangle read by rows: T(n,k) is the number of permutations of {1,2,...,n} with maximal number of initial entries of the same parity equal to k (1 <= k <= ceiling(n/2)).
0
1, 2, 4, 2, 16, 8, 72, 36, 12, 432, 216, 72, 2880, 1440, 576, 144, 23040, 11520, 4608, 1152, 201600, 100800, 43200, 14400, 2880, 2016000, 1008000, 432000, 144000, 28800, 21772800, 10886400, 4838400, 1814400, 518400, 86400, 261273600
OFFSET
1,2
COMMENTS
Sum of entries in row n is n! = A000142(n).
Row n contains ceiling(n/2) entries.
REFERENCES
E. Deutsch and J. H. Nieto, Mathematics Magazine, Problem 1823, Vol. 83, No. 3, 2010, pp. 230-231. [From Emeric Deutsch, Aug 12 2010]
FORMULA
a(2n,k) = 2nk!(2n-k-1)!binomial(n,k);
a(2n+1,k) = n!(n+1)!*binomial(2n-k+1,n).
From Emeric Deutsch, Aug 12 2010: (Start)
T(n,k) = (ceiling(n/2)*binomial(floor(n/2),k) + floor(n/2)*binomial(ceiling(n/2),k))*k!*(n-k-1)! (from J. H. Nieto's solution).
(End)
EXAMPLE
T(4,2)=8 because we have 1324, 1342, 3124, 3142, 2413, 2431, 4213 and 4231.
T(5,3)=12 because the first 3 entries form a permutation of (1,3,5) (6 choices) and the last 2 entries form a permutation of {2,4} (2 choices).
Triangle starts:
1;
2;
4, 2;
16, 8;
72, 36, 12;
432, 216, 72;
MAPLE
ae := proc (n, k) options operator, arrow: 2*n*factorial(k)*factorial(2*n-k-1)*binomial(n, k) end proc: ao := proc (n, k) options operator, arrow: factorial(n)*factorial(n+1)*binomial(2*n-k+1, n) end proc: a := proc (n, k) if `mod`(n, 2) = 0 and k <= (1/2)*n then ae((1/2)*n, k) elif `mod`(n, 2) = 1 and k <= ceil((1/2)*n) then ao((1/2)*n-1/2, k) else 0 end if end proc: for n to 12 do seq(a(n, k), k = 1 .. ceil((1/2)*n)) end do; # yields sequence in triangular form
MATHEMATICA
ae[n_, k_] := 2*n*k!*(2*n - k - 1)!*Binomial[n, k];
ao[n_, k_] := n!*(n + 1)!*Binomial[2*n - k + 1, n];
a[n_, k_] := Which[Mod[n, 2] == 0 && k <= n/2, ae[n/2, k], Mod[n, 2] == 1 && k <= Ceiling[n/2], ao[(n - 1)/2, k], True, 0];
Table[a[n, k], {n, 1, 12}, {k, 1, Ceiling[n/2]}] // Flatten (* Jean-François Alcover, Sep 05 2024, after Maple program *)
CROSSREFS
Cf. A000142.
Sequence in context: A134763 A370135 A290645 * A186526 A350816 A326723
KEYWORD
nonn,tabf
AUTHOR
Emeric Deutsch, Dec 26 2008
STATUS
approved