How many ways to place $n$ balls in $k$ bins with the minimum number of balls in any bin equal to $m$?

I assume from your example that the balls are indistinguishable, but the bins are not.

Let us first answer the question for "every bin has at least $m$ balls": Since each of the $k$ bins must have at least $m$ balls, we can remove $m$ balls from each bin: after removing these $mk$ balls, what we are left with is a distribution of $n - mk$ balls into $k$ bins, with any sort of distribution allowed. (Equivalently, we want the number of integer solutions to $y_1 + \dots y_k = n$ where each $y \ge m$; we can set $x_i = y_i - m$ and ask for nonnegative solutions to $x_1 + \dots + x_k = n - mk$ instead.)

The number of ways of distributing $(n-mk)$ balls into $k$ bins, or the number of nonnegative integer solutions to $x_1 + \dots + x_k = n - mk$, is $$\binom{n-mk+k-1}{k-1}$$ (see "stars and bars"), so that is the answer to our question (every bin having at least $m$ balls).

Now to your question, that the minimum number of balls among all bins is exactly $m$ (rather than at least $m$). This precisely means that:

  • every bin has at least $m$ balls
  • not every bin has at least $m+1$ balls

So we just subtract the number of solutions where every bin has at least $m + 1$ balls as above, getting the answer:

$$\binom{n-mk+k-1}{k-1} - \binom{n-mk-1}{k-1}$$


Let there be $x_i$ balls in bin $i$ where $i=1...k$. The total number of balls being $n$ means that

$x_1+x_2+...+x_k=n$.

Since each $x_i>=m$ you may define $y_i=x_i-m$ and have $y_i>=0$, and also

[1] $y_1+y_2+...+y_k=n-mk.$

Now you want at least one of these $y_k$ to be $0$, which complicates the count. That is, there is a standard formula for the number of solutions to [1] if you just require nonnegative $y_i$, but requiring at least one of them to be zero may be harder.

Maybe an approch based on the fact that "at least one being 0" is the complement of "all being at least 1" will help.