OFFSET
0,6
FORMULA
G.f. = z + (1-z)^2*[1-z+z^2-sqrt(1-2z-z^2-2z^3+z^4)]/(2z^2)
D-finite with recurrence (n+2)*a(n) -3*n*a(n-1) +(n-4)*a(n-2) +(-n+1)*a(n-3) +3*(n-5)*a(n-4) +(-n+7)*a(n-5)=0. - R. J. Mathar, Jul 26 2022
EXAMPLE
a(6)=5 because we have UHHHHD, UHDUHD, UUHHDD, UHUHDD and UUHDHD, where U=(1,1), D=(1,-1) and H=(1,0).
MAPLE
G:=z+1/2*(1-z)^2/z^2*(1-z+z^2-sqrt(1-2*z-z^2-2*z^3+z^4)): Gser:=series(G, z=0, 40): 1, seq(coeff(Gser, z^n), n=1..37);
MATHEMATICA
CoefficientList[Series[x+(1-x)^2 (1-x+x^2-Sqrt[1-2x-x^2-2x^3+x^4])/(2x^2), {x, 0, 40}], x] (* Harvey P. Dale, Dec 24 2016 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Emeric Deutsch, Sep 11 2004
STATUS
approved