OFFSET
0,3
COMMENTS
Weighted sum of the four previous terms.
LINKS
Index entries for linear recurrences with constant coefficients, signature (4,3,2,1).
FORMULA
G.f.: (8*x^3 + 2*x^2 -x)/(x^4 + 2*x^3 + 3*x^2 +4*x -1).
MATHEMATICA
LinearRecurrence[{4, 3, 2, 1}, {0, 1, 2, 3}, 27] (* or *)
RecurrenceTable[{a[n] == 4 a[n - 1] + 3 a[n - 2] + 2 a[n - 3] + a[n - 4], a[0] == 0, a[1] == 1, a[2] == 2, a[3] == 3}, a, {n, 0, 26}] (* or *)
a[n_] := 4 a[n - 1] + 3 a[n - 2] + 2 a[n - 3] + a[n - 4]; a[0] = 0; a[1] = 1; a[2] = 2; a[3] = 3; Array[a, 27, 0] (* or *)
CoefficientList[ Series[(8 x^3 + 2 x^2 - x)/(x^4 + 2 x^3 + 3 x^2 + 4 x - 1), {x, 0, 26}], x]
PROG
(PARI) a(n)=([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 1, 2, 3, 4]^n*[0, 1, 2, 3]~)[1] \\ Charles R Greathouse IV, May 19 2015
(Magma) [n le 4 select n-1 else 4*Self(n-1)+3*Self(n-2)+2*Self(n-3)+Self(n-4): n in [1..40]]; // Vincenzo Librandi, May 20 2015
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Robert G. Wilson v, May 19 2015
STATUS
approved