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.
%I A321313 #15 Aug 31 2021 08:08:23 %S A321313 1,0,4,4,36,256,1282,9864,99976,970528,9702848,113092200,1500063930, %T A321313 20985500212,305177475748,4733232671056,79461918315024, %U A321313 1427464201289584,26955955609799728,531536672155429792,10980840178654738496,238597651836121062824,5446220581860028853936 %N A321313 Number of permutations of [n] with equal lengths of the longest increasing subsequence and the longest decreasing subsequence. %H A321313 Alois P. Heinz, <a href="/A321313/b321313.txt">Table of n, a(n) for n = 1..80</a> %H A321313 Wikipedia, <a href="https://en.wikipedia.org/wiki/Longest_increasing_subsequence">Longest increasing subsequence</a> %F A321313 a(n) = n! - 2 * A321314(n). %F A321313 a(n) = A321315(n) - A321314(n). %F A321313 a(n) = A321316(n,0). %p A321313 h:= l-> (n-> add(i, i=l)!/mul(mul(1+l[i]-j+add(`if`(j> %p A321313 l[k], 0, 1), k=i+1..n), j=1..l[i]), i=1..n))(nops(l)): %p A321313 f:= l-> `if`(l[1]=nops(l), h(l)^2, 0): %p A321313 g:= (n, i, l)-> `if`(n=0 or i=1, f([l[], 1$n]), %p A321313 g(n, i-1, l) +g(n-i, min(i, n-i), [l[], i])): %p A321313 a:= n-> g(n$2, []): %p A321313 seq(a(n), n=1..23); %t A321313 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 A321313 f[l_] := If[l[[1]] == Length[l], h[l]^2, 0]; %t A321313 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 A321313 a[n_] := g[n, n, {}]; %t A321313 Array[a, 25] (* _Jean-François Alcover_, Aug 31 2021, after _Alois P. Heinz_ *) %Y A321313 Column k=0 of A321316. %Y A321313 Cf. A000142, A003316, A321314, A321315. %K A321313 nonn %O A321313 1,3 %A A321313 _Alois P. Heinz_, Nov 03 2018