What is the probability that all $n$ colors are selected in $m$ trials? I have a concrete problem, say, there are $n$ different balls ($n$ different colors to distinguish them), each ball will be selected uniformly at random. The way I choose a ball is that I randomly get a ball, and write down its color．Then I put  this ball back to the collection and choose a ball again. It won't stop until I get $m$ recorded colors. Suppose $m \geq n$. How many ways are there such that all $n$ colors were selected? And what is the probability that all $n$ different colors are recorded in the consecutive $m$ selections? My guts tell me there are $n^m$ combinations in total, but my rusty math halts me there.  Thank you in advance.  

There are $n^m$ possible colour strings, all equally likely. Now we count the favourables. The favourables are the functions from a set of $m$ elements to a set of $n$ elements that are onto.
The number of such functions is given by $n!$ times the Stirling Number of the Second Kind often denoted by $S(m,n)$. There is no known closed form for $S(m,n)$, but there are useful recurrences.
So our probability is $\frac{n!S(m,n)}{n^m}$.
Remark: Another way to count the favourables is to use Inclusion/Exclusion. There are $n^m$ functions. There are are $(n-1)^m$ functions that "miss" a particular number, so an estimate for the number of favourables is $n^m-\binom{n}{1}(n-1)^m$. But this double-subtracts the functions that miss two elements, so an improved estimate for the number of favourables is $n^m-\binom{n}{1}(n-1)^m+\binom{n}{2}(n-2)^m$. Continue.
