OFFSET
0,2
LINKS
G. C. Greubel, Table of n, a(n) for n = 0..1000
Index entries for linear recurrences with constant coefficients, signature (6,-9).
FORMULA
a(n) = 2 * (n+2) * 3^(n-2), n > 0. - Sean A. Irvine, Jun 27 2022
From G. C. Greubel, Nov 24 2023: (Start)
a(n) = (2*(n+2)*3^n + 5*[n=0])/9.
G.f.: (1-4*x+5*x^2)/(1-3*x)^2. [corrected by Jason Yuen, Oct 24 2024]
E.g.f.: (1/9)*( 5 + 2*(2 + 3*x)*exp(3*x) ). (End)
EXAMPLE
a(3) = 9 + 1 + 1 + 3 + 1 + 1 + 3 + 1 + 1 + 9.
MATHEMATICA
LinearRecurrence[{6, -9}, {1, 2, 8}, 41] (* G. C. Greubel, Nov 24 2023 *)
PROG
(Magma) [1] cat [n le 2 select 2^(2*n-1) else 6*Self(n-1) -9*Self(n-2): n in [1..40]]; // G. C. Greubel, Nov 24 2023
(SageMath) [(2*(n+2)*3^n + 5*int(n==0))//9 for n in range(41)] # G. C. Greubel, Nov 24 2023
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Peter Luschny, Nov 12 2011
EXTENSIONS
More terms from Sean A. Irvine, Jun 27 2022
STATUS
approved