OFFSET
1,2
LINKS
Vincenzo Librandi, Table of n, a(n) for n = 1..200
Index entries for linear recurrences with constant coefficients, signature (3,1,-3).
FORMULA
a(n) = (5*3^n + (-1)^n - 6)/8 . - Paul D. Hanna, Sep 23 2007
a(n) = 3*a(n-1)+a(n-2)-3*a(n-3). G.f.: x*(2*x+1) / ((x-1)*(x+1)*(3*x-1)). - Colin Barker, Apr 30 2014
MAPLE
a[0]:=0:a[1]:=1:for n from 2 to 50 do a[n]:=2*a[n-1]+3*a[n-2]+3 od: seq(a[n], n=1..33); # Zerinvary Lajos, Dec 14 2008
MATHEMATICA
CoefficientList[Series[(2 x + 1)/((x - 1) (x + 1) (3 x - 1)), {x, 0, 40}], x] (* Vincenzo Librandi, May 01 2014 *)
Table[FromDigits[PadRight[{}, n, {1, 2}], 3], {n, 30}] (* or *) LinearRecurrence[ {3, 1, -3}, {1, 5, 16}, 30] (* Harvey P. Dale, Dec 15 2019 *)
PROG
(PARI) Vec(x*(2*x+1)/((x-1)*(x+1)*(3*x-1)) + O(x^100)) \\ Colin Barker, Apr 30 2014
CROSSREFS
KEYWORD
nonn,base,easy
AUTHOR
STATUS
approved