0

My nephew was at a birthday party this weekend where there was a Piñata. When he came back, he was telling me which of the guests were able to collect more candies, and which of the guests were able to collect fewer candies.

After talking to him, I started wondering about the following question:

  • If there are $m$ candies and $n$ guests - how many different ways can these candies be divided amongst these guests? Let's assume that it's possible that some guests get $0$ candies and that candies are discrete.

  • How many ways can these candies be distributed if some constraints are applied? (e.g. each guest must have at least one candy and no guest can have more than $3$ candies)

I tried to research this on the internet (e.g. Number of draws before you see all candies? ), and for the first question, I think this formula might work:

$$\binom{n-1}{m+n-1} = \frac{(n-1)!}{m!(n-1-m)!} = \frac{(m+n-1)!}{m!(n-1)!}$$

However, I am not sure how to solve the second question.

Can someone please show me how to do this?

Thanks!

N. F. Taussig
  • 76,571
stats_noob
  • 3,112
  • 4
  • 10
  • 36
  • 1
    Are the candies distinguishable? – Golden_Ratio Mar 20 '23 at 01:03
  • Assuming that the candies are indistinguishable, and the people are distinguishable, see this answer, which provides a method of attack for the more generic problem. Although the cited answer starts with the assumption that the variables have an upper bound, but no lower bound, Addendum-2 considers the variables (also) having the lower bound of $~+1.~$ ...see next comment – user2661923 Mar 20 '23 at 04:07
  • Re last comment, to attack the more general problem of (different) lower bounds, you simply generalize on the method discussed in Addendum-2 of the cited answer. For example, if $~x_1~$ is required to be $~\geq 7,~$ then you would employ the change of variable $~y_1 = x_1 - 7.$ – user2661923 Mar 20 '23 at 04:09

1 Answers1

2

From your own answer to your first problem, it seems that you want to distinguish between the guests but not between the candies.

In that case, the second problem is the problem of balls in bins with limited capacity.

First distribute the minimum number of candies to each guest – in this case $1$. Then distribute the remaining $m-n$ candies among the guests with a remaining capacity of $2$ candies per guest. The page linked to above uses inclusion–exclusion to derive both a general result for individual capacities per guest and the following result for constant capacity $R$ per guest (in your variables; on that page $m$ and $n$ are reversed):

$$ \sum_{t=0}^n(-1)^t\binom nt\binom{n+m-t(R+1)-1}{n-1}\;, $$

so with capacity $R=2$ remaining per guest and $m-n$ candies remaining, that would be

$$ \sum_{t=0}^n(-1)^t\binom nt\binom{m-3t-1}{n-1}\;. $$

Here, contrary to the usual convention, the binomial coefficient is taken to be zero if the upper index becomes negative.

joriki
  • 238,052