OFFSET
0,2
COMMENTS
Also real parts of 3^n*(1+i)^n, where i=sqrt(-1).
If |a(n)| > 0 then it is in A130505.
LINKS
Bruno Berselli, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (6,-18).
FORMULA
G.f.: (1-3*x)/(1-6*x+18*x^2).
a(n) = 3^n*A146559(n) = (1/2)*((3+3*i)^n+(3-3*i)^n), where i=sqrt(-1).
a(n) = 6*a(n-1)-18*a(n-2) for n>1.
a(n) = (3*sqrt(2))^n*cos(pi*n/4).
a(4k+2) = 0, a(4k+1) = 3*a(4k) = 18*a(4k-1) = 3*(-324)^k.
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
MATHEMATICA
CoefficientList[Series[(1 - 3 x)/(1 - 6 x + 18 x^2), {x, 0, 30}], x] (* Vincenzo Librandi, Mar 26 2013 *)
LinearRecurrence[{6, -18}, {1, 3}, 40] (* Harvey P. Dale, Jul 27 2021 *)
PROG
(PARI) Vec((1-3*x)/(1-6*x+18*x^2) +O(x^26))
(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]];
(Maxima) makelist(coeff(taylor((1-3*x)/(1-6*x+18*x^2), x, 0, n), x, n), n, 0, 25);
(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
CROSSREFS
KEYWORD
sign,easy
AUTHOR
Bruno Berselli, Aug 04 2011
STATUS
approved