<s>[INST] Solving $x+2y+5z=100$ in nonnegative integers I have not done combinatorics since high school, so this is an embarrassingly simple question.
We can solve the diophantine equation $x+y+z=100$ in nonnegative integers using the "bars and boxes" combinatorial method. We have $100$ dots, and we want place 2 partition markers among them, so the answer is ${ 102 \choose 2}$. Is there a way to generalize this (by a change of variable, perhaps) to equations like $x+2y+5z=100$? I know we can handle the case where we need to solve in positive integers by making the substitutions $x\rightarrow x+1$ and so forth, but I can't think of a way to apply a similar technique when the coefficients aren't $1$. 
If not, is there a slick way to handle these more general equations?
 [/INST] You can solve this problem by using the idea of generating functions; specifically, for the example above, let $c_n$ be the number of positive integer solutions to the equation
$$x+2y+5z=n$$
Then the generating function $f(a)$ for the sequence $a_i$ is 
$$f(a)=c_0+c_1a+c_2a^2+c_3a^3+...+c_na^n+...$$
We have
$$f(a)=(1+a+a^2+...+a^i+...)(1+a^2+a^4+...+a^{2j}+...)(1+a^5+a^{10}+...+a^{5k}+...)$$
The exponents $i, j, k$ correspond the values of $x, y, z$ respectively in your equation above.
However, expanding that polynomial is still quite inconvenient. As such, we can re-write the formula as follows
$$f(a)=\frac{1}{1-a}\frac{1}{1-a^2}\frac{1}{1-a^5}$$
Using partial fractions, we re-write $f(a)$ as follows
$$f(a)=\frac{-a^4-a^3+a^2+1}{5(1-a^5)}+\frac{13}{40(1-a)}+\frac{1}{8(1+a)}+\frac{1}{4(1-a)^2}+\frac{1}{10(1-a)^3}$$
$$f(a)=\frac{1}{5}(-a^4-a^3+a^2+1)(1+a^5+a^{10}+a^{15}+...)+\frac{13}{40}(1+a+a^2+a^3+...)+\frac{1}{8}(1-a+a^2-a^3+a^4-...)+\frac{1}{4}(1+2a+3a^2+4a^3+...)+\frac{1}{10}(1+3a+6a^2+10a^3+15a^4+...)$$
Therefore, $$c_{100}=\frac{1}{5}+\frac{13}{40}+\frac{1}{8}+\frac{1}{4}\times 101+\frac{1}{10}\times \binom{102}{2}=541$$
</s>