login
A386227
Expansion of e.g.f. cosh(x)^2*(1 + x + x^2/2).
2
1, 1, 3, 6, 20, 40, 152, 224, 1024, 1152, 6272, 5632, 35840, 26624, 194560, 122880, 1015808, 557056, 5144576, 2490368, 25427968, 11010048, 123207680, 48234496, 587202560, 209715200, 2759852032, 905969664, 12817793024, 3892314112, 58921582592, 16642998272, 268435456000, 70866960384
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.
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