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
a(n) = 5*n - a(n-1), n>=2.
From Harvey P. Dale, Jun 29 2011: (Start)
a(n) = a(n-1) + a(n-2) - a(n-3), n>=4.
G.f.: x*(2+3*x*(2-x))/((1-x)^2*(1+x)). (End)
From G. C. Greubel, May 16 2016: (Start)
E.g.f.: (1/4)*(5*(1 + 2*x)*exp(x) + 7*exp(-x) - 12).
a(n) = a(n-1) + a(n-2) - a(n-3). (End)
Sum_{n>=1} (-1)^(n+1)/a(n) = 1/3 + sqrt((5-2*sqrt(5))/5)*Pi/5. - Amiram Eldar, Feb 24 2023
a(n) = A166520(n) - (-1)^n. - G. C. Greubel, Aug 04 2024
MATHEMATICA
RecurrenceTable[{a[1]==2, a[n]==5n-a[n-1]}, a[n], {n, 70}] (* or *) LinearRecurrence[{1, 1, -1}, {2, 8, 7}, 70] (* Harvey P. Dale, Jun 29 2011 *)
PROG
(Magma) [5*n/2 + (5+7*(-1)^n)/4: n in [1..70]]; // Vincenzo Librandi, May 15 2013
(SageMath)
def A166539(n): return (5*n - 1 + 7*((n+1)%2))//2
[A166539(n) for n in range(1, 101)] # G. C. Greubel, Aug 04 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Vincenzo Librandi, Oct 16 2009
STATUS
approved