%I #28 May 03 2022 13:17:46
%S 1,7,16,31,49,73,100,133,169,211,256,307,361,421,484,553,625,703,784,
%T 871,961,1057,1156,1261,1369,1483,1600,1723,1849,1981,2116,2257,2401,
%U 2551,2704,2863,3025,3193,3364,3541,3721,3907,4096,4291,4489,4693,4900
%N Expansion of x*(1+5*x+2*x^2+x^3)/((1+x)*(1-x)^3).
%H <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,0,-2,1).
%F From _R. J. Mathar_, Jul 10 2009: (Start)
%F a(n) = 2*a(n-1) - 2*a(n-3) + a(n-4) = 5/8 - 3n/2 + 9n^2/4 + 3*(-1)^n/8.
%F G.f.: x*(1+5*x+2*x^2+x^3)/((1+x)*(1-x)^3). (End)
%p A121410 := proc(nmin) local M,a,v, wev,wod,n ; a := [] ; M := linalg[matrix](2,2,[0,1,-1,2]) ; v := linalg[vector](2,[1,7]) ; wev := linalg[vector](2,[0,3]) ; wod := linalg[vector](2,[0,6]) ; while nops(a) < nmin do a := [op(a),v[1]] ; n := nops(a)+1 ; v := evalm(M &* v) ; if n mod 2 = 0 then v := evalm(v+wev) ; else v := evalm(v+wod) ; fi ; od: RETURN(a) ; end: A121410(80) ; # _R. J. Mathar_, Sep 18 2007
%t M := {{0, 1}, {-1, 2} } v[1] = {1, 7} w[n_] = If[Mod[n, 2] == 0, {0, 3}, {0, 6}] v[n_] := v[n] = M.v[n - 1] + w[n] a = Table[v[n][[1]], {n, 1, 30}]
%t CoefficientList[Series[x (1+5x+2x^2+x^3)/((1+x)(1-x)^3),{x,0,50}],x] (* or *) LinearRecurrence[{2,0,-2,1},{1,7,16,31},50] (* _Harvey P. Dale_, Mar 10 2017 *)
%Y Cf. A003215, A005448.
%K nonn
%O 1,2
%A _Roger L. Bagula_, Sep 07 2006
%E Edited by _N. J. A. Sloane_, Sep 16 2006
%E More terms from _R. J. Mathar_, Sep 18 2007
%E New name from _Joerg Arndt_, Jun 28 2013
|