Complex counting problem 
A code has five symbols and each symbol is composed of a letter, a number, and a color. (Ex.{a,3,black} is a symbol)
there are $p$ letters, $q$ numbers and $r$ colors to choose from.
a code is generated at random.

The problem is to find number of possibilities of various cases.
For example,
what is the probability that a code has three symbols with the same number and two symbols with the another same number.
So far I know that:

there are $pqr$ total possible symbols and $(pqr)^5$ possible codes.
I should have $\binom{q}{2}$ ways to choose two such numbers to be in a symbol and 20 ways to arrange the two numbers in a code.

So would the probability be $\frac{\binom{q}{2}20\times pr}{(pqr)^5}$ ???

Close.
There are $\binom q 1$ ways to choose a number to be used thrice, $\binom {q-1}1$ ways to choose a number to be used twice, $\binom 5 3$ ways to choose places for those numbers, and then we have to select letters and colours as before, $(pr)^5$, which is a common factor with the denominator (so can be cancelled).
$$\dfrac{ \binom q 1~\binom {q-1}1~\binom 5 3}{q^5} ~=~\dfrac{10(q-1)}{q^4}$$
