%I #16 Jul 24 2022 12:46:54
%S 0,1,3,7,17,40,94,222,526,1252,2994,7191,17343,41989,102023,248712,
%T 608168,1491349,3666685,9037003,22323243,55259206,137058248,340567477,
%U 847711177,2113455657,5277115687,13195311961,33038994039,82829585094,207905352180
%N Number of h- and H-steps at level 0 in all lattice paths in B(n).
%C B(n) is the set of lattice paths of weight n that start in (0,0), end on the horizontal axis and never go below this axis, whose steps are of the following four kinds: h = (1,0) of weight 1, H = (1,0) of weight 2, u = (1,1) of weight 2, and d = (1,-1) of weight 1. The weight of a path is the sum of the weights of its steps.
%C a(n) = Sum(k*A247299(n,k), 0<=k<=n).
%H Alois P. Heinz, <a href="/A247300/b247300.txt">Table of n, a(n) for n = 0..1000</a>
%H M. Bona and A. Knopfmacher, <a href="http://dx.doi.org/10.1007/s00026-010-0060-7">On the probability that certain compositions have the same number of parts</a>, Ann. Comb., 14 (2010), 291-306.
%F G.f.: 4*z*(1 + z)/(1 - z - z^2 +sqrt((1 + z + z^2)*(1 - 3*z + z^2)))^2.
%F a(n) ~ sqrt(525 + 235*sqrt(5)) * ((3 + sqrt(5))/2)^n / (sqrt(2*Pi)*n^(3/2)). - _Vaclav Kotesovec_, Mar 06 2016
%F Equivalently, a(n) ~ 5^(3/4) * phi^(2*n + 4) / (sqrt(Pi) * n^(3/2)), where phi = A001622 is the golden ratio. - _Vaclav Kotesovec_, Dec 06 2021
%F D-finite with recurrence -(n+5)*(74*n-105)*a(n) +(90*n^2+287*n+109)*a(n-1) +(190*n^2-89*n+43)*a(n-2) +(206*n^2-289*n+23)*a(n-3) +(42*n^2-301*n+337)*a(n-4) -(58*n-37)*(n-5)*a(n-5)=0. - _R. J. Mathar_, Jul 24 2022
%e a(3)=7 because in B(3) = {ud, hH, Hh, hhh} all h- and H-steps are at level 0.
%p G := 4*z*(1+z)/(1-z-z^2+sqrt((1+z+z^2)*(1-3*z+z^2)))^2: Gser := series(G, z = 0, 33): seq(coeff(Gser, z, n), n = 0 .. 30);
%p # second Maple program:
%p b:= proc(n, y) option remember; `if`(y<0 or y>n or n<0, 0,
%p `if`(n=0, [1, 0], (p-> p+`if`(y=0, [0, p[1]], 0))
%p (b(n-1, y) +b(n-2, y)) +b(n-2, y+1) +b(n-1, y-1)))
%p end:
%p a:= n-> b(n, 0)[2]:
%p seq(a(n), n=0..50); # _Alois P. Heinz_, Sep 17 2014
%t b[n_, y_] := b[n, y] = If[y<0 || y>n || n<0, 0, If[n == 0, {1, 0}, Function[{p}, p + If[y == 0, {0, p[[1]]}, 0]][b[n-1, y] + b[n-2, y]] + b[n-2, y+1] + b[n-1, y-1]]] ; a[n_] := b[n, 0][[2]]; Table[a[n], {n, 0, 50}] (* _Jean-François Alcover_, May 27 2015, after _Alois P. Heinz_ *)
%Y Cf. A247299.
%K nonn
%O 0,3
%A _Emeric Deutsch_, Sep 17 2014