Counting all possible arrangements I try to solve the following counting problem:
We consider a new type of gamble. In this one there are 7 red balls, 5 blue balls and 3 purple balls. The presenter now rolls a 4-sided die for each red ball, an 8-sided die for each blue ball, and a 12-sided die for each purple ball, and writes the result on the ball. The 15 balls are then placed together in a box. How many possible arrangements of the balls can be created in this way when drawing? Assume that the balls cannot be distinguished by handwriting.
What I did so far:
First, I counted the number of possibilities in which the balls can be numbered. I think there are $12^3\cdot 8^5\cdot 4^7$ possibilities. Now it only remains to count the possible arrangements of the balls.
If any two balls would always be distinguishable, we would have $15!$ possibilities. Thus the answer would be $n:=15!\cdot 12^3\cdot 8^5\cdot 4^7$. But unfortunately it may happen that the balls are indistinguishable (when their color and number coincide). So the answer must be less than $n$, because we effectively counted some events multiple times. But in my head everything becomes so foggy at this point. How to deal with those cases?
 A: The answer to your problem is
$$n=\frac{15!}{3!\cdot5!\cdot7!}\cdot 12^3\cdot 8^5\cdot 4^7.\tag1$$
A simple argument leading to (1) is the following. First arrange the unnumbered balls and then number them choosing the range according to the color.
The same result may be obtained in a much more complicated algebraic way as follows.
After numbering the balls they have two properties: color and number. Two balls which share both color and number are indistinguishable and we will denote the number of such balls as $k_{ij}$, where $i$ and $j$ stay for color and number respectively. $k_{ij}$ can be arbitrary non-negative integer numbers subject to the condition
$$
\sum_{j=1}^{J_i} k_{ij}=K_i\tag2,
$$
where $K_i$ and $J_i$ are the number of balls of the $i$-th color and the range of numbers which can be assigned to these balls, respectively.
With these definitions the total number of possible combinations is ($m$ is the number of colors, $K=\sum_{i=1}^m K_m$ is the number of balls):
$$\begin{align}
n&=\sum_{k_{ij}}^{(2)}\frac{K!}{\prod\limits_{i=1}^m\prod\limits_{j=1}^{J_i} k_{ij}!}\\
&=\sum_{k_{ij}}^{(2)}\frac{K!}{\prod\limits_{i=1}^m K_i!}
\prod\limits_{i=1}^m\frac{K_i!}{\prod\limits_{j=1}^{J_i} k_{ij}!}\\
&=\frac{K!}{\prod\limits_{i=1}^m K_i!}
\prod\limits_{i=1}^m\sum_{k_{ij}}^{(2)}\frac{K_i!}{\prod\limits_{j=1}^{J_i} k_{ij}!}\\
&=\frac{K!}{\prod\limits_{i=1}^m K_i!}\prod\limits_{i=1}^m J_i^{K_i}.\tag3
\end{align}$$
A: Maybe this: Let's handle each color separately-
Look on a random permutation of the $15$ balls we have:
3 balls are going to be purple, 5 are going to be blue and 7 are going to be red,
hence there are
$${15\choose3}{12\choose5}$$
possibilities to select places for the balls, by color.
Then, you would like to use
$$Select(n,k) ={k+n-1 \choose k}$$ that is the number to choose $k$ items out of $n$ with the possibility to choose again, and with no importance of order
That gives us the number of possibilities to select each group of balls, and now we only need to plug everything together to get:
$${15\choose3}{12\choose5}\cdot{3+12-1\choose3}{5+8-1\choose5}{4+7-1\choose4} \\
={15 \choose3}{12\choose5}\cdot{14\choose3}{12\choose5}{10\choose4}$$
