login
a(n) = 3*a(n-2) for n > 2; a(1) = 3, a(2) = -1.
3

%I #12 Sep 08 2022 08:45:46

%S 3,-1,9,-3,27,-9,81,-27,243,-81,729,-243,2187,-729,6561,-2187,19683,

%T -6561,59049,-19683,177147,-59049,531441,-177147,1594323,-531441,

%U 4782969,-1594323,14348907,-4782969,43046721,-14348907,129140163

%N a(n) = 3*a(n-2) for n > 2; a(1) = 3, a(2) = -1.

%C Third binomial transform is A162560.

%C Equivalently, 3^n followed by -3^(n-1), n > 0. - _Muniru A Asiru_, Oct 25 2018

%H G. C. Greubel, <a href="/A162852/b162852.txt">Table of n, a(n) for n = 1..1000</a>

%H <a href="/index/Rec#order_02">Index entries for linear recurrences with constant coefficients</a>, signature (0,3).

%F a(n) = ((4-5*(-1)^n)*3^(1/4*(2*n-1+(-1)^n)))/3.

%F G.f.: x*(3-x)/(1-3*x^2). [corrected by _Klaus Brockhaus_, Sep 18 2009]

%F E.g.f.: (1 - cosh(sqrt(3)*x) + 3*sqrt(3)*sinh(sqrt(3)*x))/3. - _G. C. Greubel_, Oct 24 2018

%p seq(op([3^n,-3^(n-1)]),n=1..18); # _Muniru A Asiru_, Oct 25 2018

%t Rest[CoefficientList[Series[x*(3-x)/(1-3*x^2), {x, 0, 40}], x]] (* or *) LinearRecurrence[{0,3}, {3,-1}, 40] (* _G. C. Greubel_, Oct 24 2018 *)

%o (Magma) [ n le 2 select 7-4*n else 3*Self(n-2): n in [1..34] ];

%o (PARI) x='x+O('x^40); Vec(x*(3-x)/(1-3*x^2)) \\ _G. C. Greubel_, Oct 24 2018

%o (GAP) a:=[3,-1];; for n in [3..25] do a[n]:=3*a[n-2]; od; a; # _Muniru A Asiru_, Oct 25 2018

%Y Cf. A162560, A162436, A162766, A162813.

%K sign

%O 1,1

%A _Klaus Brockhaus_, Jul 14 2009