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
G.f.: (1 - x^2 + 4*x^3 + 2*x^4) / ((1 - x^2)*(1 - x - x^2)).
a(n) = 3*Fibonacci(n+1) - 3 - (-1)^n + 2*0^n.
a(n) = a(n-1) + 2*a(n-2) - a(n-3) - a(n-4) for n>4. - Philippe Deléham, Dec 16 2008
From Colin Barker, Jul 12 2017: (Start)
a(n) = (3*2^(-n-1)*((1 + sqrt(5))^(n+1) - (1-sqrt(5))^(n+1))) / sqrt(5) - 4 for n>0 and even.
a(n) = (3*2^(-n-1)*((1+sqrt(5))^(n+1) - (1-sqrt(5))^(n+1)))/sqrt(5) - 2 for n odd.
(End)
MATHEMATICA
Table[3*Fibonacci[n+1] -3 -(-1)^n +2*Boole[n==0], {n, 0, 40}] (* G. C. Greubel, Jun 16 2022 *)
PROG
(PARI) Vec((1-x^2+4*x^3+2*x^4) / ((1-x^2)*(1-x-x^2)) + O(x^50)) \\ Colin Barker, Jul 12 2017
(SageMath) [3*fibonacci(n+1) -2 -2*((n+1)%2) +2*bool(n==0) for n in (0..40)] # G. C. Greubel, Jun 16 2022
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Sep 19 2008
STATUS
approved