OFFSET
0,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (1, 3, -1).
FORMULA
a(n) = a(n-1) + 3a(n-2) - a(n-3) for n>3; G.f.: (1+4x-6x^2+x^3)/(1-x-3x^2+x^3).
EXAMPLE
a(4)=18 since ((1+5+2+17)^2 - (1^2+5^2+2^2+17^2))/17 = (25^2-217)/17 = 18.
MATHEMATICA
Join[{1}, LinearRecurrence[{1, 3, -1}, {5, 2, 17}, 30]] (* Harvey P. Dale, Jul 07 2011 *)
PROG
(PARI) a(0)=1; a(1)=5; 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
AUTHOR
Paul D. Hanna, Sep 16 2003
STATUS
approved