OFFSET
0,6
COMMENTS
Number of ternary sequences of length n with a positive even number of 0's, an odd number >= 3 of ones and no restriction on the number of 2's.
LINKS
Index entries for linear recurrences with constant coefficients, signature (8,-22,20,11,-28,12).
FORMULA
a(n) = (3^n - (-1)^n)/4 - (n + 2)*2^(n-2) + n for n >= 2.
G.f.: 2*x^5*(5 - 10*x + 3*x^2)/((1 - 3*x + 2*x^2)^2*(1 - 2*x - 3*x^2)). - Stefano Spezia, May 24 2026
EXAMPLE
For n=7, the 266 strings are the 35 permutations of 0000111, the 21 permutations of 0011111 and the 210 permutations of 001122.
MATHEMATICA
LinearRecurrence[{8, -22, 20, 11, -28, 12}, {0, 0, 0, 0, 0, 10, 60, 266}, 31] (* Amiram Eldar, May 23 2026 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, May 21 2026
STATUS
approved
