# Thread: How many ways can candy be distributed?

1. ## How many ways can candy be distributed?

The question is, if there are 30 pieces of candy, and 20 babies. How many ways can the candy be divided amongst the babies such that all of the candy has been given out?

My initial thought is that, we could obviously give 30 pieces to a single baby, thus there are 20 options there. Next we can give 29 to a single baby and one to every other. So there would be 19 combinations for every baby with 29. Thus 19 times 20 options? I can't seem to come up with a function for this. Help!

2. ## Re: How many ways can candy be distributed?

Originally Posted by mathmansam
The question is, if there are 30 pieces of candy, and 20 babies. How many ways can the candy be divided amongst the babies such that all of the candy has been given out?
Assume that the pieces of candy are identical for this purpose.
The number of ways to put N identical objects into K different cells is:
$\displaystyle \binom{N+K-1}{N}=\frac{(N+K-1)!}{N!(K-1)!}$

N is the number of candies and K here will be the number of children.

3. ## Re: How many ways can candy be distributed?

Thank you! I realized that this was able to be solved with the above equation or n+k-1Ck-1 moments after posting. Love it here!!

4. ## Re: How many ways can candy be distributed?

Originally Posted by mathmansam
Thank you! I realized that this was able to be solved with the above equation or n+k-1Ck-1 moments after posting. Love it here!!
Here is something confusing to note.
If the candies are all different then the answer is
$\displaystyle 20^{30}$.