%I #37 Sep 08 2022 08:44:59
%S 2,3,10,27,82,243,730,2187,6562,19683,59050,177147,531442,1594323,
%T 4782970,14348907,43046722,129140163,387420490,1162261467,3486784402,
%U 10460353203,31381059610,94143178827,282429536482,847288609443,2541865828330,7625597484987
%N Expansion of (2-3*x-x^2)/((1-x^2)*(1-3*x)).
%H Vincenzo Librandi, <a href="/A052929/b052929.txt">Table of n, a(n) for n = 0..1000</a>
%H INRIA Algorithms Project, <a href="http://ecs.inria.fr/services/structure?nbr=915">Encyclopedia of Combinatorial Structures 915</a>
%H <a href="/index/Rec#order_03">Index entries for linear recurrences with constant coefficients</a>, signature (3,1,-3).
%F G.f.: (2-3*x-x^2)/((1-x^2)*(1-3*x)).
%F a(n) = 3*a(n-1) + a(n-2) - 3*a(n-3), a(0)=2, a(1)=3, a(2)=10.
%F a(n) = 3^n + Sum_{alpha=RootOf(-1+z^2)} alpha^(-n)/2.
%F a(n) = 2*A033113(n+1) - 3*A033113(n) - A033113(n-1). - _R. J. Mathar_, Nov 28 2011
%F From _Bruno Berselli_, Aug 27 2013: (Start)
%F a(n) = 3^n + (1+(-1)^n)/2.
%F a(n) = Sum_{k=0..n} (-1)^k + 2^k*binomial(n,k). (End)
%p spec:= [S, {S=Union(Sequence(Prod(Z,Z)), Sequence(Union(Z,Z,Z)))}, unlabeled]: seq(combstruct[count](spec, size=n), n=0..20);
%p seq(3^n + (1+(-1)^n)/2, n=0..30); # _G. C. Greubel_, Oct 17 2019
%t Table[3^n + (1+(-1)^n)/2, {n, 0, 30}] (* _Bruno Berselli_, Aug 27 2013 *)
%t LinearRecurrence[{3, 1, -3}, {2, 3, 10}, 40] (* _Vincenzo Librandi_, Mar 09 2018 *)
%t Table[3^n + Fibonacci[n+1,0], {n,0,30}] (* _G. C. Greubel_, Oct 17 2019 *)
%o (Magma) [&+[(-1)^k+2^k*Binomial(n,k): k in [0..n]]: n in [0..30]]; // _Bruno Berselli_, Aug 27 2013
%o (PARI) x='x+O('x^30); Vec((2-3*x-x^2)/((1-x^2)*(1-3*x))) \\ _Altug Alkan_, Mar 09 2018
%o (Sage) [3^n + (1+(-1)^n)/2 for n in (0..30)] # _G. C. Greubel_, Oct 17 2019
%o (GAP) List([0..30], n-> 3^n + (1+(-1)^n)/2 ); # _G. C. Greubel_, Oct 17 2019
%Y Cf. A052531: 2^n + (1+(-1)^n)/2.
%K nonn,easy
%O 0,1
%A encyclopedia(AT)pommard.inria.fr, Jan 25 2000
%E More terms from _James A. Sellers_, Jun 05 2000