How many ways are there to purchase $24$ croissants which come in packages of sizes $3$ and $6$? A croissant shop has $8$ different types of croissants that come in packages of size $3$.  Additionally, there are $5$ different types of gluten-free croissants available that only come in packages of size $6$.  You want to buy exactly $24$ croissants and do not buy any duplicates of any package.  How many different ways are there to purchase croissants?
I was thinking of counting the number of ways you could buy packages of $6$ (without duplication) from $0$ packages to $4$ packages, and filling the rest with different packages of $3$ until we reach $24$ croissants.  Then, I would add these together.
$0$ packages of $6 + 8$ packages of $3$ $${8 \choose 3} $$
$1$ packages of $6 + 6$ packages of $3$ $${6\choose 1} \cdot {8\choose6}$$
$2$ packages of $6 + 4$ packages of $3$ $${6\choose 2} \cdot {8\choose4}$$
$3$ packages of $6 + 2$ packages of $3$ $${6\choose 3} \cdot {8\choose2}$$
$4$ packages of $6 + 0$ packages of $3$ $${6\choose 4} \cdot {8\choose4}$$
number of different ways  = $${8 \choose 3} + {6\choose 1}{8\choose6} + {6\choose 2}{8\choose4} + {6\choose 3}{8\choose2} + {6\choose 4}{8\choose4}$$
I'm not sure if this is the correct approach or not.
 A: I see that @N.F.Taussig gave you what you need.Hence , i want to give you another approach that facilitate your work. We make use of generating functions. Your question says that there will not be any dublication ,so for example if we choose $9$ croissants from  $8$ different types of croissants that come in packages of size $3$ , then we must select $3$ types of croissants in $8$ different types of croissants by $\binom{8}{3}$.
Now , it is the time for constructing our generating functions such that

*

*For $8$  different types of croissants that come in packages of size $3$ : $$\binom{8}{0}x^0 +\binom{8}{1}x^3 + \binom{8}{2}x^6 + \binom{8}{3}x^9 + \binom{8}{4}x^{12} +\binom{8}{5}x^{15} + \binom{8}{6}x^{18} + \binom{8}{7}x^{21} + \binom{8}{8}x^{24}$$
Then , what does that expression mean ? The answer is it represents the number of selections such that $\color{red}{x}$ means the croissants that come in packeges of size $3$ , the exponents represent the total number of croissants in packeges of size $3$ , the binomial coefficients mean the number of selection to construct the total croissant in exponentials. For example , the binomial coefficient of $\binom{8}{6}x^{18}$ means the number of all ways to construct $18$ croissants by using only the croissants in packeges of size $3$

*

*For $5$  different types of gluten-free croissants  come in packages of size $6$: $$\binom{5}{0}x^0 +\binom{5}{1}x^6 + \binom{5}{2}x^{12} + \binom{5}{3}x^{18} + \binom{5}{4}x^{24} +\binom{5}{5}x^{30} $$
The explanation is similar to foregoing generating function. I guess you got the logic.
Now , it is time for reaching the conclusion. We want to know how many way there are to buy $24$ croissants. We can find it by multiplying these two expression , and find the coefficient of $x^{24}$ . It will give you the result , because , for example when we multiply them , one of the pieces that play role in constructing $24$ croissants is $\binom{8}{6}x^{18} \times \binom{5}{1}x^6$. This means that select $6$ types from $8$ different types of croissants that come in packages of size  $3$ ,and select one type from  $5$ different types of gluten-free croissants come in packages of size $6$ . $\binom{8}{6} \times \binom{5}{1} =140 $ is the number of making that selections.
Now , the question is "how can i find $[x^{24}]$ in the product of these two expression". Answer is that you can do it by hands if you have knowledge over generating functions , if not , just use wolfram-alpha or other softwares.
I want to point out something here , as you can realize , these two generating function form are like binomial expression such as $$\bigg(1+ x^3\bigg)^8 \text{and} \bigg(1+ x^6 \bigg)^5 \text{,respectively}.$$
Then , search $x^{24}$ in $$\bigg(1+ x^3\bigg)^8 \times \bigg(1+ x^6 \bigg)^5$$
CALCULATION FOR YOU
Result is $\color{blue}{1126}$ , it match with @N.F.Taussig's answer.
A: The cases you considered are correct.  However, you seem to be confusing the number of packages with their size.  There are eight packages which contain three croissants each and five packages which contain six gluten-free croissants each.
Since each selected package must be different, if $k$ distinct packages of six gluten-free croissants are purchased, then
$$\frac{24 - 6k}{3} = 8 - 2k$$
distinct packages of three croissants must be selected.  The number of ways of selecting exactly $k$ of the five packages of six gluten-free croissants and $8 - 2k$ of the eight packages of three croissants is
$$\binom{5}{k}\binom{8}{8 - 2k}$$
Since a total of $24$ croissants are purchased, $0 \leq k \leq 4$.  Hence, the number of admissible ways to purchase $24$ croissants is
$$\sum_{k = 0}^{4} \binom{5}{k}\binom{8}{8 - 2k} = \binom{5}{0}\binom{8}{8} + \binom{5}{1}\binom{8}{6} + \binom{5}{2}\binom{8}{4} + \binom{5}{3}\binom{8}{2} + \binom{5}{4}\binom{8}{0}$$
