%I #72 Sep 21 2023 19:26:08
%S 0,1,0,-1,-5,-14,-35,-81,-180,-389,-825,-1726,-3575,-7349,-15020,
%T -30561,-61965,-125294,-252795,-509161,-1024100,-2057549,-4130225,
%U -8284926,-16609455,-33282989,-66669660,-133507081,-267285605,-535010414,-1070731475
%N a(n) = a(n-1) + a(n-2) - 2^(n-1) with a(0)=a(2)=0, a(1)=-a(3)=1, a(4)=-5.
%H Vincenzo Librandi, <a href="/A227200/b227200.txt">Table of n, a(n) for n = 0..1000</a>
%H C. N. Phadte and S. P. Pethe, <a href="http://ami.ektf.hu/uploads/papers/finalpdf/AMI_41_from205to210.pdf">On Second Order Non-homogeneous recurrence relation</a>, Annales Mathematicae et informaticae, 41 (2013), pp. 205-210.
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,-1,-2).
%F G.f.: x*(1-3*x)/((1-2*x)*(1-x-x^2)).
%F a(n) = -(-1)^n*A142585(n+1) = A000032(n+1) - 2^n. [_Bruno Berselli_, Oct 03 2013]
%F a(n) = 3*a(n-1) -a(n-2) -2*a(n-3). [_Bruno Berselli_, Oct 03 2013]
%t Table[LucasL[n + 1] - 2^n, {n, 0, 30}] (* _Bruno Berselli_, Oct 03 2013 *)
%t CoefficientList[Series[x (1 - 3 x)/((1 - 2 x) (1 - x - x^2)), {x, 0, 40}], x](* _Vincenzo Librandi_, Oct 05 2013 *)
%o (BASIC)
%o LET N=0
%o LET L=0
%o LET M=1
%o PRINT L
%o PRINT M
%o FOR I=1 TO 30
%o LET N=M+L-(2)^(I-1)
%o PRINT N
%o LET L=M
%o LET M=N
%o NEXT I
%o END
%o (Magma) m:=30; R<x>:=PowerSeriesRing(Integers(), m); [0] cat Coefficients(R!((1-3*x)/((1-2*x)*(1-x-x^2)))); // _Bruno Berselli_, Oct 03 2013
%o (PARI) a(n)=fibonacci(n)+fibonacci(n+2)-2^n \\ _Charles R Greathouse IV_, Oct 03 2013
%o (Magma) I:=[0,1,0,-1,-5]; [n le 5 select I[n] else Self(n-1)+Self(n-2)-2^(n-3): n in [1..35]]; // _Vincenzo Librandi_, Oct 05 2013
%Y Cf. versions with different signs: A027974, A142585.
%Y Cf. A000032, A000045.
%K sign,easy
%O 0,5
%A _Chandrakant N Phadte_, Sep 18 2013
%E More terms from _Bruno Berselli_, Oct 03 2013
|