# Definition:Subfactorial

## Definition

Let $n \in \Z_{\ge0}$ be a (strictly) positive integer.

The subfactorial of $n$ is defined and denoted as:

 $\ds !n$ $:=$ $\ds n! \sum_{k \mathop = 0}^n \frac {\left({-1}\right)^k} {k!}$ $\ds$ $=$ $\ds n! \left({1 - \dfrac 1 {1!} + \dfrac 1 {2!} - \dfrac 1 {3!} + \cdots + \dfrac {\left({-1}\right)^n} {n!} }\right)$

It arises as the number of derangements of $n$ distinct objects.

### Sequence of Subfactorials

The sequence of subfactorials begins:

$\begin{array}{r|r} n & !n \\ \hline 0 & 1 \\ 1 & 0 \\ 2 & 1 \\ 3 & 2 \\ 4 & 9 \\ 5 & 44 \\ 6 & 265 \\ 7 & 1 \, 854 \\ 8 & 14 \, 833 \\ \end{array}$

## Also denoted as

The subfactorial can also be denoted as $D_n$, where the $D$ derives from derangements.