Skip to content

Subfactorial

The number of derangements of n objects: permutations that leave no element in its original position.

Subfactorial(n)the number of derangements of n objects.

Domain: Combinatorics

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