TITLE: coefficient of $x^{17}$ in the expansion of $(1+x^5+x^7)^{20}$
QUESTION [7 upvotes]: I found this questions from past year maths competition in my country, I've tried any possible way to find it, but it is just way too hard.

find the coefficient of $x^{17}$ in the expansion of $(1+x^5+x^7)^{20}$
(A)3400 (B)3410 (C)3420 (D)3430 (E)3440

so it would be $$x^{140} + ...... + 1$$
This requires binomial theorem and Multinomial theorem, but I'm not sure how to calculate it. Any tips or formula would be appreciate.

REPLY [5 votes]: Usage of the multinomial coefficient $(k_1, k_2, \cdots, k_n)$!:

$$
\big( 1 + x^5 + x^7\big)^{20} = \sum_{k_1=1}^{20} \sum_{k_2=1}^{20-k_1}
(k_1, k_2, 20 - k_1 - k_2)! x^{5k_1} x^{7k_2},
$$

where

$$
(k_1, k_2, \cdots, k_n)! = \frac{ (k_1 + k_2 + \cdots + k_n )! }
{ k_1! k_2! \cdots k_n!}.
$$

So we get $k_1=2$ and $k_2=1$, thus

$$
(2,1,17)! = \frac{(2+1+17)!}{
\begin{array}
{ccc}2! & 1! & 17!\\
\downarrow & \downarrow & \downarrow\\
2 \times 5 & 1 \times 7 & 17 \times 0
\end{array}
} = 3420.
$$

[change in order due to comment of @Henning Makholm]