OFFSET
0,4
COMMENTS
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (-2,1,2).
FORMULA
G.f.: ( -1 - 2*x + x^2 ) / ( (x-1)*(1+2*x)*(1+x) ).
a(n) = -a(n-1) + 2*a(n-2) - 2*(-1)^n.
a(n) = -2*a(n-1) + a(n-2) + 2*a(n-3).
E.g.f.: (1/3)*(exp(x) + 3*exp(-x) - exp(-2*x)). - G. C. Greubel, Jun 04 2016
MATHEMATICA
LinearRecurrence[{-2, 1, 2}, {1, 0, 0}, 25] (* or *) Table[(1/3)*(1 + 3*(-1)^n - (-2)^n), {n, 0, 25}] (* G. C. Greubel, Jun 04 2016 *)
PROG
(Magma) [( 1-(-1)^n*2^n)/3+(-1)^n: n in [0..40] ]; // Vincenzo Librandi, Aug 06 2011
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Paul Curtz, Oct 30 2009
STATUS
approved