OFFSET
0,3
COMMENTS
a(n) is the number of ternary strings of length n that contain at most two 1's, an even number of 0's, and an even number of 2's.
LINKS
Index entries for linear recurrences with constant coefficients, signature (0,12,0,-48,0,64).
FORMULA
a(n) = n*2^(n-2) for odd n >= 3.
a(n) = 2^(n-3)*(binomial(n,2) + 4) for even n >= 4.
a(2n+1) = A229580(n+1).
G.f.: (1 + x - 9*x^2 - 6*x^3 + 32*x^4 + 16*x^5 - 8*x^6 - 32*x^7 - 32*x^8)/((1 - 2*x)^3*(1 + 2*x)^3).
EXAMPLE
a(5) = 40 since the strings are the 30 permutations of 10022, the 5 permutations of 10000, and the 5 permutations of 12222.
a(6) = 152 since the strings are (number of permutations in parentheses): 110022 (90), 110000 (15), 112222 (15), 000022(15), 002222 (15), 222222 (1), 000000 (1).
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Jul 15 2025
STATUS
approved
