OFFSET
0,5
FORMULA
a(2n) = binomial(2n-2,n-1) = A000984(n-1) (n>=1).
a(2n+1) = binomial(2n-1,n-2) = A002054(n-1) (n>=1).
G.f.: g(z)=1+(1-z)(1-q)/(1-2z+q), where q=sqrt(1-4z^2).
a(n) = binomial(n,floor(n/2)) - 2*binomial(n-1,floor((n-1)/2)) + binomial(n-2,floor((n-2)/2)) + 2*0^n. - Wesley Ivan Hurt, Sep 27 2014
D-finite with recurrence (n+1)*a(n) -n*a(n-1) +2*(-2*n+3)*a(n-2) +4*(n-4)*a(n-3)=0. - R. J. Mathar, Jul 26 2022
EXAMPLE
a(6)=6 because we have UDHHUD and the 5 Dyck paths of length 6: UDUDUD, UDUUDD, UUDDUD, UUDUDD, and UUUDDD; here U=(1,1), H=(1,0) and D=(1,-1).
MAPLE
a := proc (n) if `mod`(n, 2) = 0 then binomial(n-2, (1/2)*n-1) else binomial(n-2, (1/2)*n-5/2) end if end proc: 1, 0, seq(a(n), n = 2 .. 38);
A191529:=n->binomial(n, floor(n/2)) - 2*binomial(n-1, floor((n-1)/2)) + binomial(n-2, floor((n-2)/2)) + 2*0^n: seq(A191529(n), n=0..40); # Wesley Ivan Hurt, Sep 27 2014
MATHEMATICA
Join[{1}, Table[Binomial[n, Floor[n/2]] - 2 Binomial[n - 1, Floor[(n - 1)/2]] + Binomial[n - 2, Floor[(n - 2)/2]], {n, 40}]] (* Wesley Ivan Hurt, Sep 27 2014 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Emeric Deutsch, Jun 07 2011
STATUS
approved