%I #47 Mar 29 2024 05:43:18
%S 1,3,0,-54,-324,-972,0,17496,104976,314928,0,-5668704,-34012224,
%T -102036672,0,1836660096,11019960576,33059881728,0,-595077871104,
%U -3570467226624,-10711401679872,0,192805230237696,1156831381426176,3470494144278528
%N Expansion of (1-3*x)/(1-6*x+18*x^2).
%C Also real parts of 3^n*(1+i)^n, where i=sqrt(-1).
%C If |a(n)| > 0 then it is in A130505.
%H Bruno Berselli, <a href="/A193410/b193410.txt">Table of n, a(n) for n = 0..1000</a>
%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (6,-18).
%F G.f.: (1-3*x)/(1-6*x+18*x^2).
%F a(n) = 3^n*A146559(n) = (1/2)*((3+3*i)^n+(3-3*i)^n), where i=sqrt(-1).
%F a(n) = 6*a(n-1)-18*a(n-2) for n>1.
%F a(n) = (3*sqrt(2))^n*cos(pi*n/4).
%F a(4k+2) = 0, a(4k+1) = 3*a(4k) = 18*a(4k-1) = 3*(-324)^k.
%F G.f.: W(0)/2, where W(k) = 1 + 1/(1 - x*(3*k+3)/(x*(3*k+6) + 1/W(k+1) )); (continued fraction). - _Sergei N. Gladkovskii_, Aug 28 2013
%t CoefficientList[Series[(1 - 3 x)/(1 - 6 x + 18 x^2), {x, 0, 30}], x] (* _Vincenzo Librandi_, Mar 26 2013 *)
%t LinearRecurrence[{6,-18},{1,3},40] (* _Harvey P. Dale_, Jul 27 2021 *)
%o (PARI) Vec((1-3*x)/(1-6*x+18*x^2) +O(x^26))
%o (Magma) m:=26; R<x>:=PowerSeriesRing(Integers(), m); Coefficients(R!((1-3*x)/(1-6*x+18*x^2))); /* or */ &cat[[r,3*r,0,-54*r] where r is (-324)^n: n in [0..6]];
%o (Maxima) makelist(coeff(taylor((1-3*x)/(1-6*x+18*x^2), x, 0, n), x, n), n, 0, 25);
%o (Magma) I:=[1, 3]; [n le 2 select I[n] else 6*Self(n-1)-18*Self(n-2): n in [1..30]]; // _Vincenzo Librandi_, Mar 26 2013
%Y Cf. A066771, A121622, A130505.
%K sign,easy
%O 0,2
%A _Bruno Berselli_, Aug 04 2011