OFFSET
0,2
COMMENTS
The growth factor for large n (i.e., a(n)/a(n-1)) is (1 + sqrt(3) + sqrt(2*sqrt(3))) = A319129.
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,0,2,-1).
FORMULA
Limit_{n -> inf} a(n)/a(n-1) = (1 + sqrt(3) + sqrt(2*sqrt(3)))/2 = A319129.
G.f.: (1 + x^2) / (1 - 2*x - 2*x^3 + x^4). - Colin Barker, Sep 13 2018
MAPLE
f:= gfun:-rectoproc({a(n) = 2*(a(n-1)+a(n-3))-a(n-4), a(0) = 1, a(1) = 2, a(2) = 5, a(3) = 12}, a(n), remember):
map(f, [$0..40]); # Robert Israel, Sep 12 2018
MATHEMATICA
LinearRecurrence[{2, 0, 2, -1}, {1, 2, 5, 12}, 30] (* Vincenzo Librandi, Sep 29 2018 *)
CoefficientList[Series[(1 + x^2) / (1 - 2*x - 2*x^3 + x^4), {x, 0, 30}], x] (* Stefano Spezia, Sep 29 2018 *)
PROG
(GAP) a:=[1, 2, 5, 12];; for n in [5..30] do a[n]:=2*(a[n-1]+a[n-3])-a[n-4]; od; a; # Muniru A Asiru, Sep 12 2018
(PARI) Vec((1 + x^2) / (1 - 2*x - 2*x^3 + x^4) + O(x^40)) \\ Colin Barker, Sep 13 2018
(Magma) I:=[1, 2, 5, 12]; [n le 4 select I[n] else 2*(Self(n-1) + Self(n-3)) - Self(n-4): n in [1..30]]; // Vincenzo Librandi, Sep 29 2018
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
A.H.M. Smeets, Sep 12 2018
STATUS
approved