%I #20 Jul 22 2022 10:28:04
%S 1,1,5,16,52,170,556,1821,5973,19620,64536,212553,700903,2313864,
%T 7646670,25294673,83748689,277518319,920332567,3054319120,10143305864,
%U 33707066667,112078220233,372875904038,1241182355688,4133534991928,13772413826888,45908128269573
%N Number of horizontal segments of length 1 in all bargraphs of semiperimeter n (n>=2). By a horizontal segment of length 1 we mean a horizontal step that is not adjacent to any other horizontal step.
%H M. Bousquet-Mélou and A. Rechnitzer, <a href="http://dx.doi.org/10.1016/S0196-8858(02)00553-5">The site-perimeter of bargraphs</a>, Adv. in Appl. Math. 31 (2003), 86-112.
%H Emeric Deutsch, S Elizalde, <a href="http://arxiv.org/abs/1609.00088">Statistics on bargraphs viewed as cornerless Motzkin paths</a>, arXiv preprint arXiv:1609.00088, 2016
%F G.f.: g(z)=(1-z)^3*(1-2z-z^2-Q)/(2zQ), where Q = sqrt((1-z)(1-3z-z^2-z^3)).
%F a(n) = Sum(k*A274491(n,k), k>=0).
%F D-finite with recurrence (n+1)*a(n) +3*(-2*n+1)*a(n-1) +3*(3*n-8)*a(n-2) +6*(1)*a(n-3) +(-n+19)*a(n-4) +(-2*n+15)*a(n-5) +(-n+8)*a(n-6)=0. - _R. J. Mathar_, Jul 22 2022
%e a(4)=5 because the 5 (=A082582(4)) bargraphs of semiperimeter 4 correspond to the compositions [1,1,1], [1,2], [2,1], [2,2], [3] and the corresponding pictures give the values 0,2,2,0,1 for the number of horizontal segments of length 1.
%p g:=(1/2)*(1-z)^3*(1-2*z-z^2-Q)/(z*Q): Q:=sqrt((1-z)*(1-3*z-z^2-z^3)): gser:= series(g,z=0,30): seq(coeff(gser,z,n), n=2..27);
%t g = (1-z)^3 (1-2z-z^2-Q)/(2z Q) /. Q -> Sqrt[(1-z)(1-3z-z^2-z^3)];
%t a[n_] := SeriesCoefficient[g, {z, 0, n}];
%t Table[a[n], {n, 2, 29}] (* _Jean-François Alcover_, Jul 25 2018 *)
%Y Cf. A082582, A274491.
%K nonn
%O 2,3
%A _Emeric Deutsch_ and _Sergi Elizalde_, Jun 27 2016