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?

$\endgroup$
2
  • 1
    $\begingroup$ Are the items indistinguishable and the boxes distinguishable? Are they both indistinguishable? Both distinguishable? $\endgroup$ Jul 10, 2012 at 23:53
  • $\begingroup$ @ArturoMagidin: I'm not sure... 7 and 3 yield 4, so I think order does not matter on both counts (all indistinguishable) $\endgroup$ Jul 11, 2012 at 0:56

2 Answers 2

3
$\begingroup$

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.

$\endgroup$
1
  • $\begingroup$ So n-k+1 choose k+1 $\endgroup$ Jul 10, 2012 at 21:43
0
$\begingroup$

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.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .