OFFSET
0,2
LINKS
FORMULA
a(n)=3a(n-1)-3a(n-3); a(n)=sum{k=0..floor(n/2), comb(n-2k, k) (-1)^k 3^(n-2k) }.
EXAMPLE
G.f. = 1 + 3*x + 9*x^2 + 24*x^3 + 63*x^4 + 162*x^5 + 414*x^6 + 1053*x^7 + ...
MATHEMATICA
LinearRecurrence[{3, 0, -3}, {1, 3, 9}, 30] (* Harvey P. Dale, Jan 08 2021 *)
PROG
(PARI) {a(n) = sum(k=0, n\3, binomial(n - 2*k, k) * (-1)^k * 3^(n - 2*k))}; /* Michael Somos, Jan 30 2015 */
(PARI) {a(n) = if( n<0, 0, polcoeff( 1 / (1 - 3*x + 3*x^3) + x * O(x^n), n))}; /* Michael Somos, Jan 30 2015 */
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Paul Barry, Nov 28 2003
STATUS
approved