OFFSET
1,1
LINKS
FORMULA
G.f.: x * (2 - 3*x)/((1 - x)^2 * (1 - 3*x)).
a(n) = 5*a(n-1) - 7*a(n-2) + 3*a(n-3).
a(n) = A000340(n-1) + n.
a(n) = (3^(n+1) + 2*n - 3)/4.
a(n) = Sum_{k=0..n-1} (3 - n + k) * 3^k.
E.g.f.: exp(x)*(3*exp(2*x) + 2*x - 3)/4. - Stefano Spezia, May 28 2023
MATHEMATICA
LinearRecurrence[{5, -7, 3}, {2, 7, 21}, 28] (* Amiram Eldar, Apr 23 2022 *)
PROG
(PARI) my(N=30, x='x+O('x^N)); Vec(x*(2-3*x)/((1-x)^2*(1-3*x)))
(PARI) a(n) = (3^(n+1)+2*n-3)/4;
(PARI) b(n, k) = sum(j=0, n-1, (k-n+j)*k^j);
a(n) = b(n, 3);
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Seiichi Manyama, Apr 23 2022
STATUS
approved