login
Expansion of 1/(1 + x + 2*x^2 + 2*x^3).
4

%I #25 Sep 08 2022 08:45:08

%S 1,-1,-1,1,3,-3,-5,5,11,-11,-21,21,43,-43,-85,85,171,-171,-341,341,

%T 683,-683,-1365,1365,2731,-2731,-5461,5461,10923,-10923,-21845,21845,

%U 43691,-43691,-87381,87381,174763,-174763,-349525,349525,699051,-699051,-1398101,1398101,2796203,-2796203,-5592405

%N Expansion of 1/(1 + x + 2*x^2 + 2*x^3).

%C Essentially the same as A077953.

%H Vincenzo Librandi, <a href="/A077980/b077980.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (-1,-2,-2).

%F a(n) = (1/3) * (-1)^floor((n+1)/2) * ((2^floor(n/2+1) + (-1)^floor(n/2))). - _Ralf Stephan_, Aug 17 2013

%t LinearRecurrence[{-1, -2, -2}, {1, -1, -1}, 50] (* _Vincenzo Librandi_, Aug 17 2013 *)

%o (PARI) Vec(1/(1+x+2*x^2+2*x^3)+O(x^50)) \\ _Charles R Greathouse IV_, Sep 27 2012

%o (PARI) a(n)=1/3*(-1)^floor((n+1)/2)*((2^floor(n/2+1)+(-1)^floor(n/2))) \\ _Ralf Stephan_, Aug 17 2013

%o (Magma) I:=[1,-1,-1]; [n le 3 select I[n] else -Self(n-1)-2*Self(n-2) -2*Self(n-3): n in [1..50]]; // _Vincenzo Librandi_, Aug 17 2013

%o (Sage) (1/(1+x+2*x^2+2*x^3)).series(x, 50).coefficients(x, sparse=False) # _G. C. Greubel_, Jun 25 2019

%o (GAP) a:=[1,-1,-1];; for n in [4..50] do a[n]:=-a[n-1]-2*a[n-2]-2*a[n-3]; od; a; # _G. C. Greubel_, Jun 25 2019

%K sign,easy

%O 0,5

%A _N. J. A. Sloane_, Nov 17 2002, Jun 17 2007