OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (2,0,-1).
FORMULA
From Colin Barker, May 07 2012: (Start)
a(n) = 2*a(n-1) - a(n-3).
G.f.: (1+3*x^2)/((1-x)*(1-x-x^2)). (End)
a(n) = Fibonacci(n+3) + 3*Fibonacci(n+1) - 4. - G. C. Greubel, Jul 22 2019
EXAMPLE
a(3) = 7 + 2 + 4 = 13.
MATHEMATICA
With[{f=Fibonacci}, Table[F[n+3]+3*F[n+1]-4, {n, 0, 40}]] (* G. C. Greubel, Jul 22 2019 *)
RecurrenceTable[{a[0]==1, a[1]==2, a[n]==a[n-1]+a[n-2]+4}, a, {n, 40}] (* or *) LinearRecurrence[{2, 0, -1}, {1, 2, 7}, 40] (* Harvey P. Dale, Nov 24 2020 *)
PROG
(PARI) vector(40, n, n--; f=fibonacci; f(n+3) +3*f(n+1) -4 ) \\ G. C. Greubel, Jul 22 2019
(Magma) F:=Fibonacci; [F(n+3)+3*F(n+1)-4: n in [0..40]]; // G. C. Greubel, Jul 22 2019
(Sage) f=fibonacci; [f(n+3)+3*f(n+1)-4 for n in (0..40)] # G. C. Greubel, Jul 22 2019
(GAP) F:=Fibonacci;; List([0..40], n-> F(n+3)+3*F(n+1)-4); # G. C. Greubel, Jul 22 2019
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Alex Ratushnyak, Apr 28 2012
STATUS
approved