A052929 Expansion of g.f. (2-3*x-x^2)/((1-x^2)*(1-3*x)).
2, 3, 10, 27, 82, 243, 730, 2187, 6562, 19683, 59050, 177147, 531442, 1594323, 4782970, 14348907, 43046722, 129140163, 387420490, 1162261467, 3486784402, 10460353203, 31381059610, 94143178827, 282429536482, 847288609443, 2541865828330, 7625597484987, 22876792454962
Offset: 0
Links
- Vincenzo Librandi, Table of n, a(n) for n = 0..1000
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 915.
- Index entries for linear recurrences with constant coefficients, signature (3,1,-3).
Crossrefs
Cf. A052531: 2^n + (1+(-1)^n)/2.
Programs
-
GAP
List([0..30], n-> 3^n + (1+(-1)^n)/2 ); # G. C. Greubel, Oct 17 2019
-
Magma
[&+[(-1)^k+2^k*Binomial(n,k): k in [0..n]]: n in [0..30]]; // Bruno Berselli, Aug 27 2013
-
Maple
spec:= [S, {S=Union(Sequence(Prod(Z,Z)), Sequence(Union(Z,Z,Z)))}, unlabeled]: seq(combstruct[count](spec, size=n), n=0..20); seq(3^n + (1+(-1)^n)/2, n=0..30); # G. C. Greubel, Oct 17 2019
-
Mathematica
Table[3^n + (1+(-1)^n)/2, {n, 0, 30}] (* Bruno Berselli, Aug 27 2013 *) LinearRecurrence[{3, 1, -3}, {2, 3, 10}, 40] (* Vincenzo Librandi, Mar 09 2018 *) Table[3^n + Fibonacci[n+1,0], {n,0,30}] (* G. C. Greubel, Oct 17 2019 *)
-
PARI
x='x+O('x^30); Vec((2-3*x-x^2)/((1-x^2)*(1-3*x))) \\ Altug Alkan, Mar 09 2018
-
Sage
[3^n + (1+(-1)^n)/2 for n in (0..30)] # G. C. Greubel, Oct 17 2019
Formula
G.f.: (2-3*x-x^2)/((1-x^2)*(1-3*x)).
a(n) = 3*a(n-1) + a(n-2) - 3*a(n-3), a(0)=2, a(1)=3, a(2)=10.
a(n) = 3^n + Sum_{alpha=RootOf(-1+z^2)} alpha^(-n)/2.
From Bruno Berselli, Aug 27 2013: (Start)
a(n) = 3^n + (1 + (-1)^n)/2.
a(n) = Sum_{k=0..n} (-1)^k + 2^k*binomial(n,k). (End)
E.g.f.: exp(3*x) + cosh(x). - Elmo R. Oliveira, Mar 16 2025
Extensions
More terms from James Sellers, Jun 05 2000