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.

A321316 Number T(n,k) of permutations of [n] whose difference between the length of the longest increasing subsequence and the length of the longest decreasing subsequence equals k; triangle T(n,k), n >= 1, 1-n <= k <= n-1, read by rows.

This page as a plain text file.
%I A321316 #28 Feb 27 2021 11:18:31
%S A321316 1,1,0,1,1,0,4,0,1,1,0,9,4,9,0,1,1,0,16,25,36,25,16,0,1,1,0,25,81,125,
%T A321316 256,125,81,25,0,1,1,0,36,196,421,1225,1282,1225,421,196,36,0,1,1,0,
%U A321316 49,400,1225,4292,9261,9864,9261,4292,1225,400,49,0,1
%N A321316 Number T(n,k) of permutations of [n] whose difference between the length of the longest increasing subsequence and the length of the longest decreasing subsequence equals k; triangle T(n,k), n >= 1, 1-n <= k <= n-1, read by rows.
%H A321316 Alois P. Heinz, <a href="/A321316/b321316.txt">Rows n = 1..80, flattened</a>
%H A321316 Wikipedia, <a href="https://en.wikipedia.org/wiki/Longest_increasing_subsequence">Longest increasing subsequence</a>
%F A321316 T(n,k) = T(n,-k).
%F A321316 Sum_{k=1..n-1} T(n,k) = A321314(n).
%F A321316 Sum_{k=0..n-1} T(n,k) = A321315(n).
%F A321316 (1/2) * Sum_{k=1-n..n-1} abs(k) * T(n,k) = A321277(n).
%F A321316 (1/2) * Sum_{k=1-n..n-1}   k^2  * T(n,k) = A321278(n).
%e A321316 :                                1                             ;
%e A321316 :                          1,    0,    1                       ;
%e A321316 :                    1,    0,    4,    0,   1                  ;
%e A321316 :               1,   0,    9,    4,    9,   0,   1             ;
%e A321316 :          1,   0,  16,   25,   36,   25,  16,   0,  1         ;
%e A321316 :      1,  0,  25,  81,  125,  256,  125,  81,  25,  0, 1      ;
%e A321316 :   1, 0, 36, 196, 421, 1225, 1282, 1225, 421, 196, 36, 0, 1   ;
%p A321316 h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j>
%p A321316     l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)):
%p A321316 f:= l-> h(l)^2*x^(l[1]-nops(l)) :
%p A321316 g:= (n, i, l)-> `if`(n=0 or i=1, f([l[], 1$n]),
%p A321316      g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])):
%p A321316 b:= proc(n) option remember; g(n$2, []) end:
%p A321316 T:= (n, k)-> coeff(b(n), x, k):
%p A321316 seq(seq(T(n, k), k=1-n..n-1), n=1..10);
%t A321316 h[l_] := With[{n = Length[l]}, Total[l]!/Product[Product[1 + l[[i]] - j + Sum[If[j > l[[k]], 0, 1], {k, i + 1, n}], {j, 1, l[[i]]}], {i, 1, n}]];
%t A321316 f[l_] := h[l]^2*x^(l[[1]] - Length[l]);
%t A321316 g[n_, i_, l_] := If[n == 0 || i == 1, f[Join[l, Table[1, {n}]]], g[n, i - 1, l] + g[n - i, Min[i, n - i], Append[l, i]]];
%t A321316 b[n_] := b[n] = g[n, n, {}];
%t A321316 T[n_, k_] := Coefficient[b[n], x, k];
%t A321316 Table[Table[T[n, k], {k, 1 - n, n - 1}], {n, 1, 10}] // Flatten (* _Jean-François Alcover_, Feb 27 2021, after _Alois P. Heinz_ *)
%Y A321316 Column k=0 gives A321313.
%Y A321316 Row sums give A000142.
%Y A321316 T(n+1,n-2) gives A000290.
%Y A321316 Cf. A303697, A321277, A321278, A321314, A321315.
%K A321316 nonn,tabf
%O A321316 1,7
%A A321316 _Alois P. Heinz_, Nov 03 2018