How many distinct terms are obtained after combining all terms in the expansion of $$(1+x^3+x^5)^{20}?$$
I know the multinomial expansion, but I am not able to use that to find the distinct terms that will be obtained in this expansion. I know that the powers of $x$ will be of the form $P=3b+5c$ where $a+b+c=20$. But what after that?
You can reach any integer in $[5n,5n+4]$ via $$\begin{align}5n&=5n+3\cdot0\\ 5n+1&=5(n-1)+3\cdot2\\ 5n+2&=5(n-2)+3\cdot4\\ 5n+3&=5n+3\cdot1\\ 5n+4&=5(n-1)+3\cdot3\end{align}$$ So the only integers in $[0,100]$ that you miss are a few exceptions. $1$, $2$, $4$, and $7$ at the beginning but the after $10$ all numbers are reachable. At the end we can't hit $99=5\cdot18+3\cdot3$ nor $97=5\cdot17+3\cdot4$ but everything below is reachable. So the answer is $100+1-6=95$. Sanity check:
Output: