TITLE: Finding all possible integer solutions to $x_1+x_2+ \ldots$ where the variables have coefficients
QUESTION [5 upvotes]: I know how to find integer solutions to equations of the form $x_1+x_2+x_3=n$. You would use stars and bars and do ${n+2}\choose{2}$.
But what if the equation is of the form $x_1+3x_2+4x_3=n$. This is for the problem where you want to distribute n candies among 3 different sized boxes. One size holds one candy, another holds $3$ candies, and the other holds $4$ candies. And each box must be completely filled.
Is it even possible to use the equation approach to this problem? And if so, how?

REPLY [2 votes]: In this case, your problem is analogous to:

Finding the coefficient of $t^n$ in the expansion of
  $$(1+t+t^2+t^3+\dots)(1+t^3+t^6+t^9+\dots)(1+t^4+t^8+t^{12}+\dots)$$

You can relate your question to this in the following way: 
General term of the above expansion = $t^{x_1}\cdot t^{3x_2}\cdot t^{4x_3}=t^{x_1+3x_2+4x_3}$
And we are requiring the coefficient of $t^n$.
So the coefficient will be equal to the number of solutions of $x_1+3x_2+4x_3=n$.