OFFSET
0,2
LINKS
Robert Israel, Table of n, a(n) for n = 0..510
Index entries for linear recurrences with constant coefficients, signature (2,-2,-1,2).
FORMULA
a(n) = 2*a(n-4)-a(n-3)-2*a(n-2)+2*a(n-1). - Robert Israel, May 19 2014
MAPLE
N:= 100; # to get a(n) for n <= N
A:= <<0, 1, 0, 0>|<0, 0, 1, 0>|<0, 0, 0, 1>|<2, -1, -2, 2>>:
seq(<1|2|2|-1> . A^j . <1, 0, 0, 0>, j=0..N); # Robert Israel, May 19 2014
MATHEMATICA
CoefficientList[Series[(1-x)^(-1)/(1-x+x^2+2x^3), {x, 0, 50}], x] (* or *) LinearRecurrence[{2, -2, -1, 2}, {1, 2, 2, -1}, 50] (* Harvey P. Dale, Jul 21 2025 *)
PROG
(PARI) a(n)=([0, 1, 0, 0; 0, 0, 1, 0; 0, 0, 0, 1; 2, -1, -2, 2]^n*[1; 2; 2; -1])[1, 1] \\ Charles R Greathouse IV, Jun 02 2026
CROSSREFS
KEYWORD
sign,easy,changed
AUTHOR
N. J. A. Sloane, Nov 17 2002
STATUS
approved
