OFFSET
0,2
LINKS
Harvey P. Dale, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,3,-1).
FORMULA
a(n) = a(n-1) + 3*a(n-2) - a(n-3) for n>3.
G.f.: (1+3*x-5*x^2+x^3)/(1-x-3*x^2+x^3).
EXAMPLE
a(4) = 16 since ((1+4+2+14)^2 - (1^2+4^2+2^2+14^2))/14 = (21^2-217)/14 = 16.
MATHEMATICA
LinearRecurrence[{1, 3, -1}, {1, 4, 2, 14}, 40] (* Harvey P. Dale, Jan 19 2026 *)
PROG
(PARI) a(0)=1; a(1)=4; for(n=2, 50, a(n)=((sum(k=0, n, a(k))^2-sum(k=0, n, a(k)^2))/a(n-1))
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Paul D. Hanna, Sep 16 2003
STATUS
approved
