[go: up one dir, main page]

login
A335009
Irregular triangle read by rows: T(n,k) is the number of permutations of two copies of 1..n with the sum of the distances between equal numbers having total value n + 2*k, 0 <= k <= n*(n-1)/2.
0
1, 2, 4, 6, 24, 24, 36, 24, 144, 288, 480, 576, 432, 576, 120, 960, 2880, 6000, 10560, 12960, 18720, 18000, 17280, 11520, 14400, 720, 7200, 28800, 74880, 161280, 269280, 423360, 596160, 725760, 876960, 915840, 967680, 794880, 691200, 432000, 518400
OFFSET
1,2
COMMENTS
For the n-th row, the least possible sum of distances is n and the corresponding number of permutations is n!.
For the n-th row, the greatest possible sum of distances is n^2 and the corresponding number of permutations is (n!)^2.
FORMULA
T(n,0) = n!.
T(n,n*(n-1)/2) = n!^2.
EXAMPLE
For the 6 permutations of [1,1,2,2], there are 2 with total distance 2: [1,1,2,2] and [2,2,1,1]. the other 4 have total distances 4. Hence row 2 of the triangle is 2, 4.
For [1,1,2,2,3,3], there are 6, 24, 24, 36 permutations having total distances 3, 5, 7, 9 respectively. Hence row 3 of the triangle is 6, 24, 24, 36.
Triangle begins:
1;
2, 4;
6, 24, 24, 36;
24, 144, 288, 480, 576, 432, 576;
...
MATHEMATICA
totD[w_] := -Sum[ Subtract @@ Flatten@ Position[w, k], {k, Length[w]/2}]; row[n_] := Last /@ Tally@ Sort[totD /@ Permutations[ Flatten[ Table[{i, i}, {i, n}]]]]; Flatten[row /@ Range[5]] (* Giovanni Resta, May 19 2020 *)
PROG
(PARI) Row(n)={my(v=vector(1+n*(n-1)/2)); forperm(vector(2*n, i, (i+1)\2), p, my(u=vecsort(Vec(p), , 1), s=sum(i=1, n, abs(u[2*i]-u[2*i-1]-1))); v[1+s/2]++); v} \\ Andrew Howroyd, Aug 11 2020
CROSSREFS
Cf. A000142 (1st column), A001044 (right diagonal), A000124 (row sizes).
Sequence in context: A045960 A028988 A172451 * A086172 A261832 A141526
KEYWORD
nonn,tabf
AUTHOR
Sen-peng Eu, May 19 2020
EXTENSIONS
More terms from Giovanni Resta, May 19 2020
STATUS
approved