OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (3,0,1,-3).
FORMULA
a(n) = 3*a(n-1) + a(n-3) - 3*a(n-4).
From Bruno Berselli, Jan 20 2011: (Start)
G.f.: x*(1+2*x^2)/((1-x)*(1-3*x)*(1+x+x^2)).
a(n) = round((11*3^n-13)/26) = (11*3^n-13)/26 + ((3-7*i*sqrt(3))*(-1+i*sqrt(3))^n + (3+7*i*sqrt(3))*(-1-i*sqrt(3))^n)/(78*2^n) where i is the imaginary unit. (End)
MATHEMATICA
With[{c=PadRight[{}, 30, {1, 0, 2}]}, Table[FromDigits[Take[c, n], 3], {n, 30}]] (* or *) LinearRecurrence[{3, 0, 1, -3}, {1, 3, 11, 34}, 30] (* Harvey P. Dale, Mar 30 2012 *)
PROG
(Magma) I:=[1, 3, 11, 34]; [n le 4 select I[n] else 3*Self(n-1) +Self(n-3)-3*Self(n-4): n in [1..30]]; // Vincenzo Librandi, Nov 26 2016
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved