OFFSET
0,1
COMMENTS
In general, the ordinary generating function for the recurrence relation b(n) = 2*b(n - 2) - b(n - 1) with n>1 and b(0)=k, b(1)=m, is (k + (k + m)*x)/(1 + x - 2*x^2). This recurrence gives the closed form a(n) = ((-2)^n*(k - m) + 2*k + m).
LINKS
Ilya Gutkovskiy, Extended graphical example
Index entries for linear recurrences with constant coefficients, signature (-1,2).
FORMULA
G.f.: (4 + 9*x)/(1 + x - 2*x^2).
a(n) = (13 - (-2)^n)/3.
a(n) = A084247(n) + 3.
a(n) = (-1)^n*A154570(n+1) + 1.
a(n) = (-1)^(n-1)*A171382(n-1) + 2.
Limit_{n -> oo} a(n)/a(n + 1) = -1/2.
a(n) = 4 - (-1)^n *A001045(n). - Paul Curtz, Feb 26 2024
EXAMPLE
a(0) = (5 + 3)/2 = 4 because a(1) = 5, a(2) = 3;
a(1) = (3 + 7)/2 = 5 because a(2) = 3, a(3) = 7;
a(2) = (7 - 1)/2 = 3 because a(3) = 7, a(4) = -1, etc.
MATHEMATICA
Table[(13 - (-2)^n)/3, {n, 0, 33}]
LinearRecurrence[{-1, 2}, {4, 5}, 34]
RecurrenceTable[{a[1] == 4, a[2] == 5, a[n] == 2*a[n-2] - a[n-1]}, a, {n, 50}] (* Vincenzo Librandi, Feb 13 2016 *)
PROG
(Magma) [(13-(-2)^n)/3: n in [0..35]]; // Vincenzo Librandi, Feb 13 2016
(PARI) Vec((4 + 9*x)/(1 + x - 2*x^2) + O(x^40)) \\ Michel Marcus, Feb 25 2016
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Ilya Gutkovskiy, Feb 12 2016
STATUS
approved