Let’s suppose a set of ‘n’ marbles are randomly dropped into ‘k’ urns. In how many different ways can this be done?
To take an easy example, if n=4 and k=2 then there are 5 ways:
4 in one urn 0 in the other:
0 4
3 1
1 3
2 2
And maybe an even more difficult question: in how many different ways can this be done so that all urns are “filled” ?
(In other words, each urn has at least one marble).
I’ve done a lot of searcing and still I’m not quite sure how to calculate this and there seems to be no general formula for it.
I believe this problem reduces to that of calculating the number of integer partitions of n with length k. This sort of calculation can be done, at least formally, using a partition function.
I’m guessing bup dropped a “C”; the answer to the first question is the binomial coefficient C(n+1,k-1). The idea is that you imagine the marbles as occupying spaces 1, 3, 5, …, 2n-1; you want to add k-1 partitions, in the even spaces 0, 2, 4, …, 2n, to separate these into k sets of marbles. There are n+1 spaces for partitions, and k-1 partitions to be chosen.
For the second question, begin by putting one marble in each urn. Now you have n-k marbles left, to distribute as above: C(n-k+1,k-1).