Fill $8$ boxes with $60$ items

116 Views Asked by At

I have $8$ boxes and $60$ items: how many ways can I fill the boxes so that

  1. The order of the items in each box does not matter
  2. It does not matter which boxes are filled with which items. In other words $60\;0\;0\;0\;0\;0\;0\;0$ is the same as $0\;60\;0\;0\;0\;0\;0\;0$. In other words if we have a combination and we swap the items in $2$ of the boxes it will still count as one variation.
2

There are 2 best solutions below

0
On

I assume that the $n = 60$ items are distinct, while the $k = 8$ boxes are indistinguishable. The number of ways taking into account the order of the boxes that use $m$ specific boxes (the rest being empty) is $\binom{m}{0} m^n - \binom{m}{1} (m-1)^n + \binom{m}{2} (m-2)^n - \cdots \binom{m}{m} 0^n$ by inclusion-exclusion principle, and permuting those $m$ boxes shows that exactly $m!$ of those ways correspond to each way that uses the same $m$ boxes but where the order of the boxes is irrelevant. Thus the number of ways for the original problem that use exactly $m$ boxes is $\dbinom{n}{m} \dfrac{\sum_{i=0}^m \binom{m}{i} (m-i)^n (-1)^i}{m!}$. Then the answer can be obtained by summing that for all $m$ from $1$ to $k$.

0
On

To make the order of boxes irrelevant: I pick the items from 1 to 60, and put each in a box, with the restriction that if there is more than one empty box, I put it into the first one. If n boxes already contain an item, I have min (n + 1, 8) choices to put the next item.

Let $f(n,m)$ = "Number of ways to put $n$ items into boxes, ending up with $m$ non-empty boxes".

$f (1, 1) = 1$, and $f (1, m) = 0$ whenever $m > 1$.

$f (n + 1, 1) = 1$, $f (n+1, m) = m f (n, m) + f (n, m-1)$ whenever $m > 1$.

We then add $f (60, 1)$ to $f (60, 8)$.

Using a spreadsheet, it seems to converge to $8^n / 8!$ for $n$ items into 8 boxes. Someone more clever than me can try to find a proof for this. For the question asked (60 items in 8 boxes), the result is about $1.00000089302715 * 8^{60} / 8!$.

... but it should be obvious. There are $8^{60} - 7{60}$ ways to put 60 items into exactly 8 boxes, which needs to be divided by $8!$. The number of ways to use only 7 or fewer boxes is comparatively tiny.