A242278 Number of non-palindromic n-tuples of 3 distinct elements.
0, 6, 18, 72, 216, 702, 2106, 6480, 19440, 58806, 176418, 530712, 1592136, 4780782, 14342346, 43040160, 129120480, 387400806, 1162202418, 3486725352, 10460176056, 31380882462, 94142647386, 282429005040, 847287015120, 2541864234006, 7625592702018, 22876787671992
Offset: 1
Examples
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}.
Links
- Index entries for linear recurrences with constant coefficients, signature (3, 3, -9).
Programs
-
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}]
-
PARI
a(n)=3^n-3^ceil(n/2) \\ Charles R Greathouse IV, Dec 10 2014
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]