A052993 a(n) = a(n-1) + 3*a(n-2) - 3*a(n-3), with a(0)=a(1)=1, a(2)=4.
1, 1, 4, 4, 13, 13, 40, 40, 121, 121, 364, 364, 1093, 1093, 3280, 3280, 9841, 9841, 29524, 29524, 88573, 88573, 265720, 265720, 797161, 797161, 2391484, 2391484, 7174453, 7174453, 21523360, 21523360, 64570081, 64570081, 193710244
Offset: 0
Links
- G. C. Greubel, Table of n, a(n) for n = 0..1000
- INRIA Algorithms Project, Encyclopedia of Combinatorial Structures 1069
- László Németh and László Szalay, Sequences Involving Square Zig-Zag Shapes, J. Int. Seq., Vol. 24 (2021), Article 21.5.2.
- Index entries for linear recurrences with constant coefficients, signature (1,3,-3).
Crossrefs
Cf. A062318.
Programs
-
Magma
I:=[1,1,4]; [n le 3 select I[n] else Self(n-1) +3*Self(n-2) -3*Self(n-3): n in [1..30]]; // G. C. Greubel, Nov 21 2018
-
Maple
spec := [S,{S=Prod(Sequence(Prod(Union(Z,Z,Z),Z)),Sequence(Z))},unlabeled ]: seq(combstruct[count ](spec,size=n), n=0..20);
-
Mathematica
(3^(1+Floor[(Range@40-1)/2])-1)/2 (* Federico Provvedi, Nov 22 2018 *) LinearRecurrence[{1,3,-3}, {1,1,4}, 30] (* or *) RecurrenceTable[{a[n + 2] == 3*a[n] + 1, a[0] == 1, a[1] == 1}, a, {n,0,30}] (* G. C. Greubel, Nov 21 2018 *)
-
PARI
x='x+O('x^30); Vec(1/((1-3*x^2)*(1-x))) \\ G. C. Greubel, Nov 21 2018
-
Sage
s=(1/((1-3*x^2)*(1-x))).series(x,30); s.coefficients(x, sparse=False) # G. C. Greubel, Nov 21 2018
Formula
G.f.: 1/((1-3*x^2)*(1-x)).
a(n+2) = 3*a(n) + 1, where a(0) = a(1) = 1.
a(n) = -1/2 + Sum((1/4)*(1+3*_alpha)*_alpha^(-1-n), _alpha = RootOf(-1 + 3*_Z^2)).
a(n) = Sum{k=0..n} 3^(k/2)*(1-(-1)^k)/(2*sqrt(3)). - Paul Barry, Jul 28 2004
a(n) = (3^(1+floor((n-1)/2)) - 1)/2. - Federico Provvedi, Nov 22 2018
a(n)-a(n-1) = A254006(n). - R. J. Mathar, Feb 27 2019
Extensions
More terms from James Sellers, Jun 06 2000