How many distinct terms are there in $(1+x^{13}+x^7)^{100}$? How many distinct terms are there in $(1+x^{13}+x^7)^{100}$?
I can't seem to make any real progress.
 A: You want to find the number of distinct values $13x+7y$ where $x,y$ are non-negative integers and $x+y\leq 100$.
If $y\geq 13$ and $x\leq 93$ then $x_1=x+7,y_1=y-13$ gives $13x_1+7y_1=13x+7y$. So we can restrict our count to $0\leq y<13$ or $93<x\leq 100$ and $x+y\leq 100$.
But if $93<x\leq 100$ and $x+y\leq 100$ then $0\leq y<13$, so we really just have the restriction: $0\leq y<13, x+y\leq 100$.
Nowm there are $101$ values $x$ when $y=0,$ 
$100$ values $x$ when $y=1$, etc.
This gives a total of:
$$101+100+99+98+\cdots+(101-12)= 101\cdot 13 - (1+2+\cdots +12)=1235$$
(You need to show these are distinct. That's relatively easy - if $13x_1+7y_1=13x_2+7y_2$ then $y_2-y_1$ must be divisible by $13$. Since $0\leq y_1,y_2<13$, this means $y_1=y_2$ and hence $x_1=x_2$.)
A: This is an application of numerical semigroups.
I also refer you to a local resource, namely Robjohn's answer explaining to us that the numerical semigroup
$$\langle a,b\rangle=\{na+mb\mid n,m\in\Bbb{Z}_{\ge0}\}$$
generated by two coprime natural numbers $a,b, a<b,$ is missing a total of
$$
F(a,b)=\frac{(a-1)(b-1)}2
$$
small positive integers, the largest of which is $ab-a-b$.
In the polynomial
$$
(1+x^a+x^b)^\ell
$$
only the terms with degrees $ma+nb$ will appear. We have the further constraints
that $m,n,m+n\le\ell$, but this is of no concern when we try to figure out which low degree terms are missing. Here the exponent $\ell=100$ is large enough for us to conclude that we are missing $F(7,13)=36$ low degree terms. The highest missing low degree term has degree $ab-a-b=91-7-13=71$. We get $72=5\cdot13+1\cdot7$ with multipliers $m,n$ that are surely small enough. From that point there will be no gaps, $73=4\cdot13+3\cdot7$, $74=3\cdot13+5\cdot7,\ldots,$
until we reach high enough degrees that the constraint $n+m\le\ell=100$
begins to disturb the process.
Obviously the maximum degree is $1300=100\cdot13+0\cdot7$. To analyze the missing high degree terms consider the sum 
$$
13n+7m=(n+m)13-6m=1300-(100-n-m)13-6m.
$$
Here the integers $100-n-m$ and $m$ are non-negative. So we see that the distance to the maximum degree $1300$ is of the form $13p+6q$ with $p,q$ non-negative integers. The conclusion is that at the high end your polynomial will be missing the terms of degrees $1300-r$ where $r\notin\langle 13,6\rangle$.
It's the same business again. The numerical semigroup $\langle 13,6\rangle$
is missing $F(6,13)=30$ small positive integers, and terms of such degrees won't show up.
The answer to the question is thus
$$
1301-F(7,13)-F(6,13)=1235
$$
as already obtained by Thomas Andrews and H.H. Rugh.

The argument obviously generalizes. If $a,b, a<b,$ are coprime natural numbers, and $\ell$ is large enough, the polynomial $(1+x^a+x^b)^\ell$ will have
$$
\ell b+1-F(a,b)-F(b-a,b)=\ell b-\frac{b(b-3)}2
$$
terms. A possibly surprising consequence is that the end result does not depend on the parameter $a$ at all! For example, here we would get the same total of 1235 terms also in $(1+x^4+x^{13})^{100}$ or even $(1+x+x^{13})^{100}$.
A: Hint:  Each term is of the form $1^a(x^{13})^b(x^7)^c$ with $a+b+c=100$ and you are asked for the number of values $13b+7c$ can take. Use stars and bars to get the number of $a,b,c$ triplets.  Then think about the number of ways to get the same exponent and subtract the overcount.  For example, if $c \ge 13$, you can get the same exponent with $(a+6,b+7,c-13)$ as with $(a,b,c)$  
Another approach is to consider the number of non-representable numbers in the coin problem.  You have a number missing at each end of the polynomial.  Counting up from the bottom, your coins are $7$ and $13$, but counting down from the top (where you start with $(x^{13})^{100}$)your coins are $13$ and $6$ because trading a $13$ for a $7$ decreases the total by $6$.
Another approach is to ask Alpha.
