%I #26 Jan 02 2021 12:24:03
%S 1,1,0,1,0,1,1,0,0,1,1,2,1,0,0,1,2,3,4,3,2,1,0,0,0,1,2,5,7,9,10,10,8,
%T 5,3,1,0,0,0,1,3,7,13,19,26,32,35,35,32,26,19,13,7,3,1,0,0,0,0,1,3,9,
%U 18,32,50,72,95,117,134,143,145,138,122,101,78,55,36,21,10,4,1
%N Irregular triangular array read by rows. T(n,k) is the number of permutations of {1,2,...,n} with descent set {1,3,5,...,m} (where m is the greatest odd integer less than n) that have exactly k inversions, n=0, k=0, or n>0, 0<=k<=ceiling((n-1)^2/2).
%D R. Stanley, Enumerative Combinatorics, volume 1, second edition, Cambridge University Press (2012), p.295.
%H Alois P. Heinz, <a href="/A337126/b337126.txt">Rows n = 0..50, flattened</a>
%F Sum_{k=1..ceiling((n-1)^2/2)} k * T(n,k) = A337193(n).
%e Triangle T(n,k) begins:
%e 1;
%e 1;
%e 0, 1;
%e 0, 1, 1;
%e 0, 0, 1, 1, 2, 1;
%e 0, 0, 1, 2, 3, 4, 3, 2, 1;
%e 0, 0, 0, 1, 2, 5, 7, 9, 10, 10, 8, 5, 3, 1;
%e ...
%e T(6,5) = 5 because we have: {2, 1, 5, 4, 6, 3}, {2, 1, 6, 3, 5, 4},
%e {3, 1, 5, 2, 6, 4}, {3, 2, 4, 1, 6, 5}, {4, 1, 3, 2, 6, 5}.
%p b:= proc(u, o, t) option remember; expand(`if`(u+o=0, 1, add(
%p x^`if`(t=0, o-1+j, u-j)*b(o-1+j, u-j, 1-t), j=1..u)))
%p end:
%p T:= n-> (p-> seq(coeff(p, x, i), i=0..degree(p)))(b(n, 0$2)):
%p seq(T(n), n=0..10); # _Alois P. Heinz_, Aug 17 2020
%t Table[a = Drop[Subsets[Table[i, {i, 1, n - 1, 2}]], 1];f[list_] := (-1)^(Floor[n/2] - Length[list]) QBinomial[n, list[[1]], q] Product[
%t QBinomial[n - list[[i]], list[[i + 1]] - list[[i]], q], {i, 1,
%t Length[list] - 1}]; CoefficientList[Expand[FunctionExpand[Total[Map[f, a]] + (-1)^(Floor[n/2])]], q], {n, 0, 8}] // Grid
%t (* Second program: *)
%t b[u_, o_, t_] := b[u, o, t] = Expand[If[u + o == 0, 1, Sum[x^If[t == 0, o - 1 + j, u - j]*b[o - 1 + j, u - j, 1 - t], {j, 1, u}]]];
%t T[n_] := CoefficientList[b[n, 0, 0], x];
%t T /@ Range[0, 10] // Flatten (* _Jean-François Alcover_, Jan 02 2021, after _Alois P. Heinz_ *)
%Y Cf. A000111 (row sums), A337193 (total number of inversions).
%K nonn,tabf
%O 0,12
%A _Geoffrey Critzer_, Aug 17 2020
|