login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A052993
a(n) = a(n-1) + 3*a(n-2) - 3*a(n-3), with a(0)=a(1)=1, a(2)=4.
5
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,3
LINKS
László Németh and László Szalay, Sequences Involving Square Zig-Zag Shapes, J. Int. Seq., Vol. 24 (2021), Article 21.5.2.
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
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 *)
PROG
(PARI) x='x+O('x^30); Vec(1/((1-3*x^2)*(1-x))) \\ G. C. Greubel, Nov 21 2018
(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
(Sage) s=(1/((1-3*x^2)*(1-x))).series(x, 30); s.coefficients(x, sparse=False) # G. C. Greubel, Nov 21 2018
CROSSREFS
Cf. A062318.
Sequence in context: A367688 A127403 A276423 * A214779 A323920 A005301
KEYWORD
easy,nonn
AUTHOR
encyclopedia(AT)pommard.inria.fr, Jan 25 2000
EXTENSIONS
More terms from James A. Sellers, Jun 06 2000
STATUS
approved