login
A153773
a(2*n) = 3*a(2*n-1) - 1, a(2*n+1) = 3*a(2*n), with a(1)=1.
6
1, 2, 6, 17, 51, 152, 456, 1367, 4101, 12302, 36906, 110717, 332151, 996452, 2989356, 8968067, 26904201, 80712602, 242137806, 726413417, 2179240251, 6537720752, 19613162256, 58839486767, 176518460301, 529555380902, 1588666142706, 4765998428117, 14297995284351
OFFSET
1,2
FORMULA
From R. J. Mathar, Oct 05 2009: (Start)
a(n) = 3*a(n-1) + a(n-2) - 3*a(n-3).
G.f.: x*(-1 + x + x^2)/((1-x) * (3*x-1) * (1+x)).
a(n) = (5*3^n + 6 - 3*(-1)^n)/24. (End)
E.g.f.: (1/24)*(-3*exp(-x) - 8 + 6*exp(x) + 5*exp(3*x)). - G. C. Greubel, Aug 27 2016
EXAMPLE
a(2) = 3*1 - 1 = 2.
a(3) = 3*a(2) = 6.
a(4) = 3*a(3) - 1 = 17.
MATHEMATICA
Table[(5*3^n + 6 - 3*(-1)^n)/24 , {n, 1, 25}] (* or *) LinearRecurrence[{3, 1, -3}, {1, 2, 6}, 25] (* G. C. Greubel, Aug 27 2016 *)
RecurrenceTable[{a[1] == 1, a[2] == 2, a[3] == 6, a[n] == 3 a[n-1] + a[n-2] - 3 a[n-3]}, a, {n, 30}] (* Vincenzo Librandi, Aug 28 2016 *)
PROG
(Magma) I:=[1, 2, 6]; [n le 3 select I[n] else 3*Self(n-1)+Self(n-2)-3*Self(n-3): n in [1..30]]; // Vincenzo Librandi, Aug 28 2016
(PARI) a(n) = (3^n*5)\/24 \\ Charles R Greathouse IV, Aug 28 2016
CROSSREFS
Sequence in context: A148448 A148449 A148450 * A059398 A157002 A071717
KEYWORD
nonn,easy
AUTHOR
Clark Kimberling, Jan 01 2009
STATUS
approved