# Selecting $300$ chocolate candies from $7$ types.

How many ways are there to select $300$ chocolate candies from seven types of candy if each type comes in boxes of $20$ and if at least one but not more than five boxes of each type are chosen?

Can I get some help on this?

Edit: Preferably, using generating functions.

• Do you have to take the whole box each time? or you can take, say, two candies from one box? – Dennis Gulko Nov 6 '13 at 7:47
• I'm assuming that you're suppose to take each candy individually. – gandolf Nov 6 '13 at 7:57

Hint: the generating function for the number of candies of one type is $$x^{20} + x^{40} + x^{60} + x^{80} + x^{100}$$ So the generating function for the number of candies of seven types is...

If I understand your question correctly:
let $x_i$ be the number of candies chosen of type $i$. Then $1\leq x_i\leq 100$. You want to find the number of solutions to $\sum_{i=1}^7x_i=300$.
To solve this - first take one candy of each type. It remains to solve $\sum_{i=1}^7x_i=293$ for $0\leq x_i\leq 99$. This is equivalent to the number of ways to distribute $293$ balls into $7$ cells. Do you know how to continue?

• Why would you take $7$ of each type if the restriction is that the number of different types $x_i$ is $1 \leq x_i \leq 5$ – gandolf Nov 6 '13 at 8:12
• I do not understand you comment - where did I take $7$ of each type? – Dennis Gulko Nov 6 '13 at 8:15