%I #34 Feb 26 2024 10:26:32
%S 4,5,3,7,-1,15,-17,47,-81,175,-337,687,-1361,2735,-5457,10927,-21841,
%T 43695,-87377,174767,-349521,699055,-1398097,2796207,-5592401,
%U 11184815,-22369617,44739247,-89478481,178956975,-357913937,715827887,-1431655761,2863311535
%N a(n) = 2*a(n - 2) - a(n - 1) for n>1, a(0) = 4, a(1) = 5.
%C 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).
%H Ilya Gutkovskiy, <a href="/A268741/a268741.pdf">Extended graphical example</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (-1,2).
%F G.f.: (4 + 9*x)/(1 + x - 2*x^2).
%F a(n) = (13 - (-2)^n)/3.
%F a(n) = A084247(n) + 3.
%F a(n) = (-1)^n*A154570(n+1) + 1.
%F a(n) = (-1)^(n-1)*A171382(n-1) + 2.
%F Limit_{n -> oo} a(n)/a(n + 1) = -1/2.
%F a(n) = 4 - (-1)^n *A001045(n). - _Paul Curtz_, Feb 26 2024
%e a(0) = (5 + 3)/2 = 4 because a(1) = 5, a(2) = 3;
%e a(1) = (3 + 7)/2 = 5 because a(2) = 3, a(3) = 7;
%e a(2) = (7 - 1)/2 = 3 because a(3) = 7, a(4) = -1, etc.
%t Table[(13 - (-2)^n)/3, {n, 0, 33}]
%t LinearRecurrence[{-1, 2}, {4, 5}, 34]
%t RecurrenceTable[{a[1] == 4, a[2] == 5, a[n] == 2*a[n-2] - a[n-1]}, a, {n, 50}] (* _Vincenzo Librandi_, Feb 13 2016 *)
%o (Magma) [(13-(-2)^n)/3: n in [0..35]]; // _Vincenzo Librandi_, Feb 13 2016
%o (PARI) Vec((4 + 9*x)/(1 + x - 2*x^2) + O(x^40)) \\ _Michel Marcus_, Feb 25 2016
%Y Cf. A084247, A140683, A140966, A154570, A171382.
%Y Cf. A001045, A010709, A077925.
%K sign,easy
%O 0,1
%A _Ilya Gutkovskiy_, Feb 12 2016