%I #20 Jul 24 2022 10:31:27
%S 1,3,11,39,144,530,1987,7455,28268,107334,410354,1570954,6042984,
%T 23273172,89948835,348000975,1350028020,5241881150,20396787070,
%U 79426533758,309829067496,1209384071532,4727454837846,18490127530394
%N Sum of the lengths of the longest increasing subsequence over all 321-avoiding permutations of [n].
%C Apparently: Summed over all Dyck (n+1)-paths, the number of ascents of length 1 to the right of the midpoint (ordinate x=n+1). - _David Scambler_, Aug 08 2012
%H G. C. Greubel, <a href="/A132889/b132889.txt">Table of n, a(n) for n = 1..1000</a>
%H E. Deutsch, A. J. Hildebrand and H. S. Wilf, <a href="http://www.combinatorics.org/ojs/index.php/eljc/article/view/v9i2r12">Longest increasing subsequences in pattern-restricted permutations</a>, The Electronic Journal of Combinatorics, 9(2), 2003, #R12.
%F a(n) = Sum_{k=floor((n+1)/2)..n} k*(2*k-n+1)^2*binomial(n+1,n-k)^2 / (n+1)^2.
%F a(n) = Sum_{k=1..n} k*A126217(n,k).
%F D-finite Recurrence: n^2*(n+1)*(4*n^3 - 13*n^2 - 3*n + 24)*a(n) = 2*n*(8*n^5 - 14*n^4 - 67*n^3 + 152*n^2 - 67*n + 12)*a(n-1) + 8*(8*n^6 - 66*n^5 + 156*n^4 + 6*n^3 - 461*n^2 + 543*n - 180)*a(n-2) - 32*(n-3)*(n-2)*(2*n - 5)*(4*n^3 - n^2 - 17*n + 12)*a(n-3). - _Vaclav Kotesovec_, Mar 20 2014
%F a(n) ~ 2^(2*n-1)/sqrt(Pi*n) * (1 + 2/sqrt(Pi*n)). - _Vaclav Kotesovec_, Mar 20 2014
%e a(3)=11 because in the 321-avoiding permutations of 123, namely 123,132,312,213 and 231, the lengths of the longest increasing subsequences are 3,2,2,2 and 2, respectively.
%p a:=proc(n) options operator, arrow: (sum(k*(2*k-n+1)^2*binomial(n+1, n-k)^2,k =floor((1/2)*n+1/2)..n))/(n+1)^2 end proc: seq(a(n),n=1..25);
%t Table[Sum[k*(2*k-n+1)^2*Binomial[n+1,n-k]^2, {k,Floor[(n+1)/2],n}]/(n+1)^2,{n,1,20}] (* _Vaclav Kotesovec_, Mar 20 2014 *)
%o (PARI) for(n=1,25, print1(sum(k=floor((n+1)/2),n, k*(2*k-n+1)^2 * binomial(n+1,n-k)^2/(n+1)^2), ", ")) \\ _G. C. Greubel_, May 25 2017
%Y Cf. A126217.
%K nonn
%O 1,2
%A _Emeric Deutsch_, Sep 07 2007