OFFSET
0,1
COMMENTS
a(n) is also the trace of D^n, where D is the 3*3 matrix: first row (0,-1,0), second row (-1,1,-1), third row (-1,0,1).
REFERENCES
Sloane, N. J. A. and Plouffe, S. The Encyclopedia of Integer Sequences. San Diego, CA: Academic Press, 1995.
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 0..1000
M. Bernstein and N. J. A. Sloane, Some canonical sequences of integers, Linear Alg. Applications, 226-228 (1995), 57-72; erratum 320 (2000), 210. [Link to arXiv version]
M. Bernstein and N. J. A. Sloane, Some canonical sequences of integers, Linear Alg. Applications, 226-228 (1995), 57-72; erratum 320 (2000), 210. [Link to Lin. Alg. Applic. version together with omitted figures]
Index entries for linear recurrences with constant coefficients, signature (2,0,-2).
FORMULA
a(n) = 2*a(n-1) - 2*a(n-3), a(0)=3, a(1)=2, a(2)=4.
G.f.: (3-4*x)/(1-2*x+2*x^3).
MATHEMATICA
h[n_]:= h[n]=2*h[n-1]-2*h[n-3]; h[0]=3; h[1]=2; h[2]=4; Table[h[n], {n, 0, 40}]
CoefficientList[Series[(3-4x)/(1-2x+2x^3), {x, 0, 40}], x] (* Vincenzo Librandi, Feb 05 2014 *)
LinearRecurrence[{2, 0, -2}, {3, 2, 4}, 40] (* Harvey P. Dale, May 16 2016 *)
PROG
(Magma) I:=[3, 2, 4]; [n le 3 select I[n] else 2*Self(n-1)-2*Self(n-3): n in [1..40]]; // Vincenzo Librandi, Feb 05 2014
(PARI) my(x='x+O('x^40)); Vec((3-4*x)/(1-2*x+2*x^3)) \\ G. C. Greubel, Apr 22 2019
(Sage) ((3-4*x)/(1-2*x+2*x^3)).series(x, 40).coefficients(x, sparse=False) # G. C. Greubel, Apr 22 2019
CROSSREFS
KEYWORD
easy,sign
AUTHOR
Mario Catalani (mario.catalani(AT)unito.it), Jul 29 2002
STATUS
approved