- Assume all balls with the same color are indistinguishable.
- The order in which balls are put in a bin does not matter.
- No bins are allowed to have the same distribution of balls!
For example, this configuration
{RRGGGB} {RRRRGBBBB} {RGB} {RGB}
is not ok, because the two last bins contains the same distribution of balls: one Red, one Green, one Blue.
Actualy I'm most intressted in the procedure for solving this problem where the number of balls, colors and bins are much larger numbers.
Best Answer
This problem is a straightforward application of the Polya Enumeration Theorem. Suppose we treat the case of $r$ red balls, $g$ green balls and $b$ blue balls and $n$ indistinguishable bins where no bins are left empty.
Recall the recurrence by Lovasz for the cycle index $Z(P_n)$ of the set operator $\def\textsc#1{\dosc#1\csod} \def\dosc#1#2\csod{{\rm #1{\small #2}}}\textsc{SET}_{=n}$ on $n$ slots, which is $$Z(P_n) = \frac{1}{n} \sum_{l=1}^n (-1)^{l-1} a_l Z(P_{n-l}) \quad\text{where}\quad Z(P_0) = 1.$$
We need to employ the set operator because the elements of a distribution are supposed to be unique.
We have for example, $$Z(P_3) = 1/6\,{a_{{1}}}^{3}-1/2\,a_{{2}}a_{{1}}+1/3\,a_{{3}}$$ and $$Z(P_4) = 1/24\,{a_{{1}}}^{4}-1/4\,a_{{2}}{a_{{1}}}^{2} +1/3\,a_{{3}}a_{{1}}+1/8\,{a_{{2}}}^{2}-1/4\,a_{{4}}.$$
Applying PET it now follows almost by inspection that the desired count is given by using the repertoire
$$-1 + \sum_{q=0}^r R^q \sum_{q=0}^g G^q \sum_{q=0}^b B^q$$
with $Z(P_n)$ to get
$$[R^r G^g B^b] Z\left(P_n; -1 + \sum_{q=0}^r R^q \sum_{q=0}^g G^q \sum_{q=0}^b B^q \right).$$
The minus one term cancels empty bins.
The answer for eight red, six green and seven blue balls in four indistinguishable bins turns out to be $$60040.$$The following Maple code implements two routines, q1 and q2. The first of these computes the value for $(r,g,b)$ and $n$ by brute force (enumerate all configurations) and can be used to verify the correctness of the PET formula for small values of the parameters. The second one uses the PET for instant computation of the desired coefficient.
Observe that we can compute values that are utterly out of reach of brute force enumeration, e.g. with ten balls of each color and five bins we obtain $$7098688.$$With twenty balls of each color and six bins we get $$194589338219.$$