OFFSET
1,1
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (1,1,-1).
FORMULA
From R. J. Mathar, Jan 26 2010: (Start)
a(n) = A168213(n-1), n>1.
G.f.: x*(5 + 4*x^2)/((1+x)*(x-1)^2). (End)
From G. C. Greubel, Jul 22 2016: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3).
E.g.f.: (1/4)*(-9 + 16*exp(x) + (18*x - 7)*exp(2*x))*exp(-x). (End)
MATHEMATICA
LinearRecurrence[{1, 1, -1}, {5, 5, 14}, 60] (* Vincenzo Librandi, Feb 27 2012 *)
RecurrenceTable[{a[1]==5, a[n]==9n-a[n-1]-8}, a, {n, 60}] (* or *) With[ {c= LinearRecurrence[{2, -1}, {5, 14}, 40]}, Riffle[c, c]] (* or *) With[{c= 9* Range[ 40]-4}, Riffle[c, c]] (* Harvey P. Dale, Jan 25 2019 *)
PROG
(Magma) I:=[5, 5, 14]; [n le 3 select I[n] else Self(n-1)+Self(n-2)-Self(n-3): n in [1..60]]; // Vincenzo Librandi, Feb 28 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Nov 25 2009
STATUS
approved