%I #26 Oct 30 2022 18:19:59
%S 1,0,4,4,16,24,71,128,328,650,1552,3232,7437,15904,35884,77840,173792,
%T 379896,843411,1851264,4097552,9014038,19918944,43871360,96860441,
%U 213472064,471086932,1038595100,2291372912,5052682904,11145821407,24580005376,54217564504,119573069218
%N Moments of generalized Motzkin paths.
%H Harvey P. Dale, <a href="/A053441/b053441.txt">Table of n, a(n) for n = 2..1000</a>
%H R. A. Sulanke, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL3/SULANKE/sulanke.html">Moments of generalized Motzkin paths</a>, J. Integer Sequences, Vol. 3 (2000), #00.1.
%H <a href="/index/Rec#order_06">Index entries for linear recurrences with constant coefficients</a>, signature (0,4,2,0,0,-1).
%F G.f.: x^2*(2*x^3+1)/((1+x)*(1+x-x^2)*(1-2*x-x^3)).
%F a(n) = 4*a(n-2) + 2*a(n-3) - a(n-6); a(2)=1, a(3)=0, a(4)=4, a(5)=4, a(6)=16, a(7)=24. - _Harvey P. Dale_, Oct 24 2011
%t Drop[CoefficientList[Series[x^2(2x^3+1)/((1+x)(1+x-x^2)(1-2x-x^3)),{x,0,40}],x],2] (* or *) LinearRecurrence[{0,4,2,0,0,-1},{1,0,4,4,16,24},40] (* _Harvey P. Dale_, Oct 24 2011 *)
%o (PARI) x='x+O('x^30); Vec(x^2*(2*x^3+1)/((1+x)*(1+x-x^2)*(1-2*x-x^3))) \\ _G. C. Greubel_, May 26 2018
%o (Magma) I:=[1,0,4,4,16,24]; [n le 6 select I[n] else 4*Self(n-2) + 2*Self(n-3) -Self(n-6): n in [1..30]]; // _G. C. Greubel_, May 26 2018
%K nonn,easy,nice
%O 2,3
%A _N. J. A. Sloane_, Jan 12 2000
%E More terms from _Reiner Martin_, Oct 13 2002