OFFSET
0,2
COMMENTS
This sequence has a golden mean ratio limit.
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2, 0, -1).
FORMULA
a(n) = 2*a(n-1) - a(n-3). [Dec 03 2009]
G.f.: 2*x*(2 - x)/((1-x)*(1 -x -x^2)). [Dec 03 2009]
MATHEMATICA
M = {{0, 1}, {1, 1}} v[0] = {0, 1}; v[n_] := v[n] = M.v[n - 1] + {3, 2} a = Table[v[n][[1]], {n, 0, 30}]
LinearRecurrence[{2, 0, -1}, {0, 4, 6}, 60] (* Vladimir Joseph Stephan Orlovsky, Feb 10 2012 *)
RecurrenceTable[{a[0] == 0, a[1] == 4, a[2] == 6, a[n] == 2 a[n-1] - a[n-3]}, a, {n, 50}] (* Vincenzo Librandi, Jul 30 2016 *)
PROG
(Magma) I:=[0, 4, 6]; [n le 3 select I[n] else 2*Self(n-1)-Self(n-3): n in [1..40]]; // Vincenzo Librandi, Jul 30 2016
(PARI) a(n)=([0, 1, 0; 0, 0, 1; -1, 0, 2]^n*[0; 4; 6])[1, 1] \\ Charles R Greathouse IV, Jul 30 2016
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Roger L. Bagula and Gary W. Adamson, Jun 01 2010
EXTENSIONS
Definition simplified and notation in formulas set to OEIS standards by the Assoc. Editors of the OEIS, Dec 03 2009
STATUS
approved