Solution (source code)

= Solution

The $n$ possible matching events are independent, each with probability $1/n$. Hence
$$
\boxed{p_n=1-\left(1-\frac1n\right)^n},
$$
and therefore
$$
\boxed{\lim_{n\to\infty}p_n=1-e^{-1}}.
$$