Probability all number will appear when rolling k n-sided dice If k balanced n-sided dice are rolled, what is the probability that each of the n different numbers will appear at least once?
A case of this was discussed here, but I’m not sure how to extend this. Specifically, I’m not sure how the to calculate the numbers that can repeat term in the accepted answer.
 A: Without loss of generality, assume the dice are all uniquely identifiable (e.g. by color or by order in which they are rolled).
There are $n^k$ equally likely different ways in which the dice may all be rolled.
Now... consider the event that a $1$ never appeared on any of the dice faces.  Label this event $N_1$ (for "no ones happened").  What is the probability of this?  Well, that would be $\left(\frac{n-1}{n}\right)^k$.
Similarly, let $N_2$ be the event that no $2$'s occurred.  The probability of this as having happened will be the same... on through to $N_n$.
Consider then the event $N_1\cup N_2\cup \dots \cup N_n$, the event that at least one of the numbers was missing.
The probability of this we can figure out by expanding via inclusion exclusion as $\Pr(N_1\cup N_2\cup \dots \cup N_n) = \Pr(N_1)+\Pr(N_2)+\dots+\Pr(N_n)-\Pr(N_1\cap N_2)-\Pr(N_1\cap N_3)-\dots+\Pr(N_1\cap N_2\cap N_3)+\dots \pm \dots$ where we alternate between adding all individual events, subtracting all pairs of events, adding all triples of events, subtracting all quadruples of events, etc... either adding or subtracting all $i$-tuples of events, until we are done.
Well, we talked about the probability of $\Pr(N_1)$ before, the probability no $1$'s were rolled... similarly, $\Pr(N_1\cap N_2)$ is the probability no $1$'s and no $2$'s were rolled.  This would be $\left(\frac{n-2}{n}\right)^k$.  You can do similarly for the larger intersections as well.
Recognizing the symmetry of the problem, that all triples of events have the same probability and so on... we can simplify the expression and we are left with.  Finally, recognizing that this was the probability of there having been a missing number, the probability that all numbers were present will be the opposite, so $1$ minus that.  This gives us a final result of:
$$1 - \sum\limits_{i=1}^n (-1)^{i+1}\binom{n}{i}\left(\frac{n-i}{n}\right)^k$$

This problem type is so common, we have a shorthand way we can approach this as well using Stirling Numbers of the Second Kind.  The Stirling Number of the Second Kind, ${a\brace b}$ counts the number of ways of taking an $a$-element set and partitioning it into $b$ non-empty unlabeled parts.
Here, we take our $k$ dice, and partition it into $n$ non-empty subsets in ${k\brace n}$ ways.  We then assign a unique die-face to each of these parts in $n!$ ways.  This gives us an answer of:
$$\frac{{k\brace n}n!}{n^k}$$
A: (Please allow me to use $n$ in place of your $k$, and $m$ in place of your $n$)
So we have $n$ fair $m$-face dice.
If you consider the dies to be distinct, by color or by launching them in sequence,  then
the space of events is given by $m^n$ equiprobable words (strings , m-tuples) of length $n$
formed out of the alphabet $\{1, 2, \ldots, m \}$.
Let's consider the development of
$$
\begin{array}{l}
 \left( {x_{\,1}  + x_{\,2}  +  \cdots  + x_{\,m} } \right)^n  =  \\ 
  =  \cdots  + x_{\,j_{\,1} } x_{\,j_{\,2} }  \cdots x_{\,j_{\,n} }  +
  \cdots \quad \left| {\;j_i  \in \left\{ {1, \ldots ,m} \right\}} \right.\quad  =  \\ 
  = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {0\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)x_{\,1} ^{k_{\,1} } x_{\,2} ^{k_{\,2} }  \cdots x_{\,m} ^{k_{\,m} } }  \\ 
 \end{array}
$$
where
$$x_{\,j} ^{k_{\,j} } $$
accounts for the $j$th face (character) repeated $k_j$ times, and where putting the $x$'s at 1 we get
$$
\begin{array}{l}
 \left( {\underbrace {1 + 1 +  \cdots  + 1}_m} \right)^n  = m^n  =  \\ 
  = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {0\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)1^{k_{\,1} } 1^{k_{\,2} }  \cdots 1^{k_{\,m} } }  =  \\ 
  = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {0\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)}  \\ 
 \end{array}
$$
Out of these we want to number the cases in which $k_1, k_2 , \ldots, k_m$ are at least one, i.e.
$$
N\left( {n,m} \right) = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {1\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)} 
$$
There are $\binom{m}{m-l} = \binom{m}{l}$ ways to choose $m-l$ characters not appearing and leaving $l$ to appear at least once
so it shall be
$$
\begin{array}{l}
 m^n  = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {0\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)}  =  \\ 
  = \sum\limits_{\left( {0\, \le } \right)\,l\,\left( { \le \,m} \right)} {\left( \begin{array}{c}
 m \\  l \\ 
 \end{array} \right)\sum\limits_{\left\{ {\begin{array}{*{20}c}
   {1\, \le \,c_{\,j} \,\left( { \le \,n} \right)}  \\
   {c_{\,1}  + \,c_{\,2}  +  \cdots \, + c_{\,l} \, = \,n}  \\
\end{array}} \right.} {\;\left( \begin{array}{c}
 n \\  c_{\,1} ,\,c_{\,2} , \cdots \,,c_{\,l} \, \\ 
 \end{array} \right)} }  \\ 
 \end{array}
$$
But also it is, from the definition of the Stirling N. of 2nd kind
$$
\;m^{\,n}  = \sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {\left\{ \begin{array}{c}
 n \\  k \\  \end{array} \right\}\,m^{\,\underline {\,k\,} } }
  = \sum\limits_{\left( {0\, \le } \right)\,k\,\left( { \le \,n} \right)} {k!\left\{ \begin{array}{c}
 n \\  k \\  \end{array} \right\}\,\left( \begin{array}{c} m \\  k \\  \end{array} \right)} 
$$
and therefore
$$
N\left( {n,m} \right) = \sum\limits_{\left\{ {\begin{array}{*{20}c}
   {1\, \le \,k_{\,j} \,\left( { \le \,n} \right)}  \\
   {k_{\,1}  + k_{\,2}  + \, \cdots  + k_{\,m} \, = \,n}  \\
\end{array}} \right.\;} {\left( \begin{array}{c}
 n \\  k_{\,1} ,\,k_{\,2} ,\, \cdots ,\,k_{\,m}  \\ 
 \end{array} \right)}  = m!\left\{ \begin{array}{c}
 n \\  m \\ 
 \end{array} \right\}
$$
