Subfactorial
The number of derangements of n objects: permutations that leave no element in its original position.
Wikipedia
DerangementSubfactorialMathWorldSubfactorialWikidataQ2361661OEISA000166Wolfram LanguageSubfactorial✓Subfactorial(n)the number of derangements Details
- Closed form
, so is n! divided by e and rounded to the nearest integer. - Recurrence:
, with . - Also satisfies the two-term recurrence
. - The classic hat-check problem:
counts the ways n people can have their hats returned so nobody gets their own. - compute-engine leaves negative arguments unevaluated rather than extending Subfactorial analytically.
Examples
See also: Factorial