login
Triangle read by rows: T(n,k) is the number of permutations of [n] for which k is the maximal number of initial entries whose parities alternate (1 <= k <= n).
1

%I #15 Nov 28 2017 10:59:37

%S 1,0,2,2,2,2,8,8,0,8,48,36,12,12,12,288,216,72,72,0,72,2160,1440,576,

%T 432,144,144,144,17280,11520,4608,3456,1152,1152,0,1152,161280,100800,

%U 43200,28800,11520,8640,2880,2880,2880,1612800,1008000,432000,288000,115200,86400,28800,28800,0,28800

%N Triangle read by rows: T(n,k) is the number of permutations of [n] for which k is the maximal number of initial entries whose parities alternate (1 <= k <= n).

%C Sum of entries in row n is n! (=A000142(n)).

%C T(n,n) = A092186(n) (the parity alternating permutations; see the Tanimoto reference).

%C T(n,1) = A152661(n).

%H S. Tanimoto, <a href="http://arxiv.org/abs/0812.1839">Combinatorial study on the group of parity alternating permutations</a>, arXiv:0812.1839 [math.CO], 2008-2017.

%F T(2n,k) = 2(n!)^2*binomial(2n-k-1, n-floor(k/2));

%F T(2n+1,2k) = n!(n+1)!*binomial(2n-2k+1, n-k);

%F T(2n+1,2k+1) = n!(n+1)!*binomial(2n-2k, n-k-1) if k < n;

%F T(2n+1,2n+1) = n!(n+1)!.

%e T(4,2)=8 because we have 1243, 1423, 2134, 2314, 3241, 3421, 4132 and 4312.

%e Triangle starts:

%e 1;

%e 0, 2;

%e 2, 2, 2;

%e 8, 8, 0, 8;

%e 48, 36, 12, 12, 12;

%e 288, 216, 72, 72, 0, 72;

%p T := proc (n, k) if n < k then 0 elif `mod`(n, 2) = 0 and `mod`(k, 2) = 0 then 2*factorial((1/2)*n)^2*binomial(n-k-1, (1/2)*n-(1/2)*k) elif `mod`(n, 2) = 0 and `mod`(k, 2) = 1 then 2*factorial((1/2)*n)^2*binomial(n-k-1, (1/2)*n-(1/2)*k+1/2) elif `mod`(n, 2) = 1 and `mod`(k, 2) = 0 then factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2)*binomial(n-k, (1/2)*n-(1/2)*k-1/2) elif `mod`(n, 2) = 1 and k = n then factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2) else factorial((1/2)*n-1/2)*factorial((1/2)*n+1/2)*binomial(n-k, (1/2)*n-(1/2)*k-1) end if end proc: for n to 10 do seq(T(n, k), k = 1 .. n) end do; # yields sequence in triangular form

%t T[n0_?EvenQ, k_] := With[{n = n0/2}, 2 (n!)^2*Binomial[2 n - k - 1, n - Floor[k/2]]];

%t T[n1_?OddQ, k0_?EvenQ] := With[{n = (n1 - 1)/2, k = k0/2}, n! (n + 1)! * Binomial[2 n - 2 k + 1, n - k] ];

%t T[n1_?OddQ, k1_?OddQ] := With[{n = (n1 - 1)/2, k = (k1 - 1)/2}, n! (n+1)! * Binomial[2 n - 2 k, n - k - 1] ];

%t T[n1_?OddQ, n1_?OddQ] := With[{n = (n1 - 1)/2}, n! (n + 1)!];

%t Table[T[n, k], {n, 1, 10}, {k, 1, n}] // Flatten (* _Jean-François Alcover_, Nov 28 2017 *)

%Y Cf. A000142, A092186, A152661.

%K nonn,tabl

%O 1,3

%A _Emeric Deutsch_, Dec 12 2008