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, Nov 22 2009: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3).
a(n) = (5 - 9*(-1)^n)/4 + 3*n/2.
G.f.: x*(5 - 3*x + x^2)/((1+x)*(x-1)^2). (End)
E.g.f.: (1/4)*(-9 + 4*exp(x) + (5 + 6*x)*exp(2*x))*exp(-x). - G. C. Greubel, Jul 15 2016
Sum_{n>=1} (-1)^n/a(n) = 1/2. - Amiram Eldar, Feb 23 2023
MATHEMATICA
LinearRecurrence[{1, 1, -1}, {5, 2, 8}, 60] (* Vincenzo Librandi, Feb 28 2012 *)
nxt[{n_, a_}]:={n+1, 3n-a+4}; NestList[nxt, {1, 5}, 70][[;; , 2]] (* Harvey P. Dale, Oct 04 2024 *)
PROG
(Magma) I:=[5, 2, 8]; [n le 3 select I[n] else Self(n-1)+Self(n-2)-Self(n-3): n in [1..40]]; // Vincenzo Librandi, Feb 28 2012
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Nov 20 2009
STATUS
approved