OFFSET
0,2
LINKS
FORMULA
a(n) = a(n-1) + 3a(n-2) - a(n-3) for n>3; G.f.: (1+x-3x^2+x^3)/(1-x-3x^2+x^3).
EXAMPLE
a(4)=12 since ((1+2+2+8)^2 - (1^2+2^2+2^2+8^2))/8 = (13^2-73)/8 = 12.
MATHEMATICA
LinearRecurrence[{1, 3, -1}, {1, 2, 2, 8}, 40] (* Harvey P. Dale, Mar 24 2017 *)
PROG
(PARI) a(n)=if(n, ([0, 1, 0; 0, 0, 1; -1, 3, 1]^(n-1)*[2; 2; 8])[1, 1], 1) \\ Charles R Greathouse IV, May 27 2026
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul D. Hanna, Sep 16 2003
STATUS
approved
