This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
 BUILT-IN MATHEMATICA SYMBOL

# Subfactorial

 Subfactorial[n] gives the number of permutations of n objects that leave no object fixed.
• Mathematical function, suitable for both symbolic and numerical manipulation.
• Subfactorial can be evaluated to arbitrary numerical precision.
• A permutation in which no object appears in its natural place is called a derangement.
 Out[1]=
 Scope   (6)
Evaluate for large numbers:
Evaluate numerically for non-integer arguments:
Evaluate for complex arguments:
Evaluate to high precision:
The precision of the output tracks the precision of the input:
Subfactorial automatically threads over lists:
 Applications   (1)
There are 9 derangements of a set of 4 objects:
Here are all permutations of the set :
Delete all permutations where an object is fixed:
Check that there are only 9 derangements:
Subfactorial[n] is given by :
Recurrence relations satisfied by Subfactorial:
The only number equal to the sum of subfactorials of its digits:
New in 6