OFFSET
0,2
FORMULA
a(n) = sum(sum(M(i),i=k..n-k),k=0..n), where the M(n)'s are the Motzkin numbers.
a(n) = sum((n-i+1)*M(i),i=0..n) - sum((n-2*i)*M(i),i=0..floor(n/2)).
G.f.: (1-x+x*sqrt(1-2*x-3*x^2)-sqrt(1-2*x^2-3*x^4))/(2*x^3*(1-x)^2).
MATHEMATICA
M[n_]:=If[n==0, 1, Coefficient[(1+x+x^2)^(n+1), x^n]/(n+1)]; Table[Sum[(n-i+1)M[i], {i, 0, n}]-Sum[(n-2i)M[i], {i, 0, Floor[n/2]}], {n, 0, 30}]
PROG
(Maxima) M(n):=coeff(expand((1+x+x^2)^(n+1)), x^n)/(n+1);
makelist(sum((n-i+1)*M(i), i, 0, n)-sum((n-2*i)*M(i), i, 0, floor(n/2)), n, 0, 30);
CROSSREFS
KEYWORD
nonn
AUTHOR
Emanuele Munarini, Apr 06 2012
STATUS
approved