OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (-2,1,-1).
FORMULA
a(n) = (-1)^n * A077939(n). - Joerg Arndt, Sep 30 2012
a(n) = -2*a(n-1) + a(n-2) - a(n-3), with a(0)=1, a(1)=-2, a(2)=5. - Harvey P. Dale, Feb 14 2014
MAPLE
m:=30; S:=series(1/(1+2*x-x^2+x^3), x, m+1): seq(coeff(S, x, j), j=0..m); # G. C. Greubel, Feb 26 2020
MATHEMATICA
CoefficientList[Series[1/(1+2x-x^2+x^3), {x, 0, 30}], x] (* or *) LinearRecurrence[ {-2, 1, -1}, {1, -2, 5}, 30] (* Harvey P. Dale, Feb 14 2014 *)
b[n_]:= b[n]= If[n<3, n, 2*b[n-1] +b[n-2] +b[n-3]]; Table[(-1)^n*b[n+1], {n, 0, 30}] (* Rigoberto Florez, Jan 23 2020 *)
PROG
(PARI) Vec(1/(1+2*x-x^2+x^3)+O(x^30)) \\ Charles R Greathouse IV, Sep 26 2012
(Magma) R<x>:=PowerSeriesRing(Integers(), 30); Coefficients(R!( 1/(1+2*x-x^2+x^3) )); // G. C. Greubel, Jun 25 2019
(Sage)
def A077986_list(prec):
P.<x> = PowerSeriesRing(ZZ, prec)
return ( 1/(1+2*x-x^2+x^3) ).list()
A077986_list(30) # G. C. Greubel, Jun 25 2019
(GAP) a:=[1, -2, 5];; for n in [4..30] do a[n]:=-2*a[n-1]+a[n-2]-a[n-3]; od; a; # G. C. Greubel, Jun 25 2019
CROSSREFS
KEYWORD
sign,easy
AUTHOR
N. J. A. Sloane, Nov 17 2002
STATUS
approved