# Multinomial - Sum of coeffecients with even powers

Let P be a polynomial given by $$P(x_1,x_2,x_3, \ldots,x_n) = (k+x_1+x_2+\ldots +x_n)^m$$.

Find the sum of all coefficients of the terms of the polynomial which have even powers in each of the $$n$$ variables for $$n=6, m=6, k=6$$.

I got answer as $$83,887$$ using multinomial expansion in Python and using RegEx to remove terms with odd powers, but it's incorrect. Any help will be appreciated.

This is not an answer to the combinatorial question, but it can help to check whether a combinatorial answer could be correct.

The following code constructs the polynomial via python's sympy and loops through the coefficients. Here p.coeff() is a list of all coefficients. p.monoms is a list of tuples with the degree of each variable. sum([m % 2 for m in monom]) == 0]) is a way to select all tuples that have only even terms.

from sympy import symbols, poly

k = 6
m = 6
n = 6
x = [symbols(f'x{i}') for i in range(1, n + 1)]
p = poly((k + sum(x)) ** m)
print(sum([coeff for coeff, monom in zip(p.coeffs(), p.monoms()) if sum([m % 2 for m in monom]) == 0]))


The result is 217392.