1
$\begingroup$

Possible Duplicate:
Unique ways to keep N balls into K Boxes?

Number of ways to put N items into K bins with at least 1 per bin?

I know that normally you can do N + K + 1 choose K - 1 or something like that, but that allows for bins where nothing is placed inside. What about when there must be at least 1 item per bin?

  • 0
    @ArturoMagidin: I'm not sure... 7 and 3 yield 4, so I think order does not matter on both counts (all indistinguishable)2012-07-11

2 Answers 2

3

It's actually $\binom {n+k-1}{k-1}$ for the first problem.

If you want to ensure that every bin has at least one element, then take $n-k$ items and put them in $k$ bins as in the first prpblem, then add one item to each bin.

  • 0
    So n-k+1 choose k+12012-07-10
0

I am assuming that the $N$ items are identical. Line up the $N$ items in a row, with a little gap between the items. Choose $K-1$ of the gaps to put separators into. Put all the items from the left end to the first separator into Bin $1$, everything from the first separator to the second into Bin $2$, and so on.

Every choice of where to put the separators gives you a distribution into bins, with at least one per bin. And every distribution into bins with at least one per bin tells you where to put the separators.

So there are $\binom{N-1}{K-1}$ ways to do the job.