OFFSET
0,2
COMMENTS
See comments in A391468.
LINKS
Pablo Serra, Table of n, a(n) for n = 0..100
Pablo Serra, On the number of words of N = 3*M letters with a three-letter alphabet, arXiv:2512.22362 [math.CO], 2025.
Index entries for linear recurrences with constant coefficients, signature (27,-27,729).
FORMULA
a(n) = Sum_{n1+n2+n3=n-1} trinomial(3 * n; 3 * n1 + 1,3 * n2 + 1, 3 * n3 + 1) for n>=1.
a(n) = 3^(3*n-2) - ((1 + (-1)^n) + (1 - (-1)^n)*i*sqrt(3))*i^n*3^((3*n-2)/2)/2 for n>=1, where i is the imaginary unit.
a(n) = 27*(a(n-1) - a(n-2) + 27*a(n-3)), for n >= 4.
G.f.: 6*x*(1 - 12*x - 27*x^2)/((1 - 27*x)*(1 + 27*x^2)).
E.g.f.: (2 + exp(27*x) - 3*cos(3*sqrt(3)*x) + 3*sqrt(3)*sin(3*sqrt(3)*x))/9. - Stefano Spezia, Dec 30 2025
EXAMPLE
For n=1, the a(1) = 6 words of length 3*n = 3 are ABC, CAB, BAC, CBA, BAC, CAB.
MATHEMATICA
LinearRecurrence[{27, -27, 729}, {0, 6, 90, 2106}, 20] (* Paolo Xausa, Jan 17 2026 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Pablo Serra, Dec 29 2025
STATUS
approved
