OFFSET
1,3
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..1000
Index entries for linear recurrences with constant coefficients, signature (2, 2, 3).
FORMULA
From R. J. Mathar, Dec 12 2008: (Start)
a(n) = 3*A077834(n-3).
G.f.: 3*x^3/((1-3*x)*(1+x+x^2)). (End)
a(n) = (1/13)*(3^n + 12*cos((2*n*Pi)/3) + 2*sqrt(3)*sin((2*n*Pi)/3)), n=1,2,... - Zak Seidov, Dec 12 2008
EXAMPLE
0 + 0 + 3 = 3^1; 0 + 3 + 6 = 3^2; 3 + 6 + 18 = 3^3; ...
MATHEMATICA
k0=k1=0; lst={k0, k1}; Do[kt=k1; k1=3^n-k1-k0; k0=kt; AppendTo[lst, k1], {n, 1, 5!}]; lst
Rest[CoefficientList[Series[3x^3/((1-3x)(1+x+x^2)), {x, 0, 30}], x]] (* Harvey P. Dale, Aug 31 2014 *)
PROG
(Magma) [n le 2 select 0 else 3^(n-2) -Self(n-1)-Self(n-2): n in [1..30]]; // Vincenzo Librandi, Aug 31 2014
(PARI) x='x+O('x^30); concat([0, 0], Vec(3*x^3/((1-3*x)*(1+x+x^2)))) \\ G. C. Greubel, Sep 01 2018
CROSSREFS
KEYWORD
nonn
AUTHOR
Vladimir Joseph Stephan Orlovsky, Dec 11 2008
STATUS
approved