OFFSET
1,2
LINKS
Index entries for linear recurrences with constant coefficients, signature (3, 3, -9).
FORMULA
a(n) = 1/2 * 3^(n/2) * ((sqrt(3)-1)*(-1)^n - sqrt(3)-1) + 3^n.
a(n) = 3^n - 3^ceiling(n/2).
G.f.: (6*x) / (1 - 3*x - 3*x^2 + 9*x^3).
a(n) = 6*A167993(n). [Bruno Berselli, Aug 19 2014]
EXAMPLE
For n=3, the a(3)=18 solutions (non-palindromic 3-tuples) are:
{0,0,1}, {0,0,2}, {0,1,1}, {0,1,2}, {0,2,1}, {0,2,2}, {1,0,0}, {1,0,2},
{1,1,0}, {1,1,2}, {1,2,0}, {1,2,2}, {2,0,0}, {2,0,1}, {2,1,0}, {2,1,1},
{2,2,0}, {2,2,1}.
MAPLE
A242278:=n->(1/2)* 3^(n/2) * ((sqrt(3)-1) * (-1)^n - sqrt(3)-1) + 3^n: seq(A242278(n), n=1..28); # Wesley Ivan Hurt, Aug 17 2014.
MATHEMATICA
Table[1/2 * 3^(n/2) * ((Sqrt(3)-1) * (-1)^n - Sqrt(3)-1) + 3^n, {n, 28}]
PROG
(PARI) a(n)=3^n-3^ceil(n/2) \\ Charles R Greathouse IV, Dec 10 2014
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Mikk Heidemaa, Aug 16 2014
STATUS
approved