cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

This page as a plain text file.
%I A335009 #20 Sep 05 2020 20:05:28
%S A335009 1,2,4,6,24,24,36,24,144,288,480,576,432,576,120,960,2880,6000,10560,
%T A335009 12960,18720,18000,17280,11520,14400,720,7200,28800,74880,161280,
%U A335009 269280,423360,596160,725760,876960,915840,967680,794880,691200,432000,518400
%N 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.
%C A335009 For the n-th row, the least possible sum of distances is n and the corresponding number of permutations is n!.
%C A335009 For the n-th row, the greatest possible sum of distances is n^2 and the corresponding number of permutations is (n!)^2.
%F A335009 T(n,0) = n!.
%F A335009 T(n,n*(n-1)/2) = n!^2.
%e A335009 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.
%e A335009 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.
%e A335009 Triangle begins:
%e A335009    1;
%e A335009    2,   4;
%e A335009    6,  24,  24,  36;
%e A335009   24, 144, 288, 480, 576, 432, 576;
%e A335009   ...
%t A335009 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 *)
%o A335009 (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
%Y A335009 Cf. A000142 (1st column), A001044 (right diagonal), A000124 (row sizes).
%K A335009 nonn,tabf
%O A335009 1,2
%A A335009 _Sen-peng Eu_, May 19 2020
%E A335009 More terms from _Giovanni Resta_, May 19 2020