Solution (source code)

= Solution

In the <set> of all $n!$ <permutations>, let $A_i$ consist of those fixing $i$. For a prescribed collection of $k$ fixed points, its intersection has $(n-k)!$ members. Applying the <inclusion-exclusion principle> to the complement of $\bigcup_iA_i$ gives the number of <derangements>:
$$
\boxed{d_n=\sum_{k=0}^n(-1)^k\binom nk(n-k)!=n!\sum_{k=0}^n\frac{(-1)^k}{k!}}.
$$
The convergent <power series> for the <exponential function> at $-1$ therefore gives $\boxed{d_n/n!\longrightarrow e^{-1}}$.