OFFSET
0,3
LINKS
Colin Barker, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (1,2,-1,-1).
FORMULA
For n>1, a(n) = Fibonacci(n-1) + Lucas(n) - (3 + (-1)^n)/2. - Ralf Stephan, May 13 2004
From Colin Barker, Jul 12 2017: (Start)
G.f.: (1 - x^2 + x^3 + x^4 + x^5) / ((1 - x)*(1 + x)*(1 - x - x^2)).
a(n) = 2^(-1-n)*(-5*((-2)^n + 3*2^n) - (-15+sqrt(5))*(1+sqrt(5))^n + (1-sqrt(5))^n*(15+sqrt(5))) / 5 for n>1.
a(n) = a(n-1) + 2*a(n-2) - a(n-3) - a(n-4) for n>5.
(End)
MATHEMATICA
Join[{1, 1}, Table[Fibonacci[n-1]+LucasL[n]-(3+(-1)^n)/2, {n, 2, 40}]] (* or *) Join[{1, 1}, LinearRecurrence[{1, 2, -1, -1}, {2, 4, 7, 13}, 40]] (* Harvey P. Dale, Sep 27 2011 *)
PROG
(PARI) Vec((1 - x^2 + x^3 + x^4 + x^5) / ((1 - x)*(1 + x)*(1 - x - x^2)) + O(x^50)) \\ Colin Barker, Jul 12 2017
(Magma) [n eq 1 select 1 else 3*Fibonacci(n+1) - 2*Fibonacci(n) - (3+(-1)^n)/2: n in [0..40]]; // G. C. Greubel, Jun 16 2024
(SageMath) [3*fibonacci(n+1) -2*fibonacci(n) -(3+(-1)^n)//2 + int(n==1) for n in range(41)] # G. C. Greubel, Jun 16 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
STATUS
approved