login
A388428
Expansion of e.g.f. (1 + x)*(1 + x^2/2)*cosh(x).
0
1, 1, 2, 6, 7, 35, 16, 112, 29, 261, 46, 506, 67, 871, 92, 1380, 121, 2057, 154, 2926, 191, 4011, 232, 5336, 277, 6925, 326, 8802, 379, 10991, 436, 13516, 497, 16401, 562, 19670, 631, 23347, 704, 27456, 781, 32021, 862, 37066, 947, 42615, 1036, 48692, 1129, 55321, 1226, 62526, 1327, 70331
OFFSET
0,3
COMMENTS
Number of ternary strings of length n with none or one 1's, none or two 0's, and an even number of 2's.
FORMULA
a(n) = binomial(n,2) + 1, n even.
a(n) = 3*binomial(n,3) + n, n odd.
G.f.: (1 + x - 2*x^2 + 2*x^3 + 5*x^4 + 17*x^5 - 4*x^6 + 4*x^7)/(1 - x^2)^4. - Vaclav Kotesovec, Oct 16 2025
EXAMPLE
a(4) = 7 since the strings are 2222 and the 6 permutations of 0022.
a(5) = 35 since the strings are the 30 permutations of 00122 and the 5 permutations of 12222.
MATHEMATICA
a[n_] := If[EvenQ[n], Binomial[n, 2] + 1, 3*Binomial[n, 3] + n]; Array[a, 54, 0] (* Amiram Eldar, Oct 21 2025 *)
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Enrique Navarrete, Oct 15 2025
STATUS
approved