Quick guide
How to use this calculator
- Enter the number of distinct objects.
- Every object is required to move from its original position.
- Read the exact derangement, also called the subfactorial.
Calculation method
Use the derangement recurrence
The recurrence !n=(n−1)(!(n−1)+!(n−2)) starts from !0=1 and !1=0.
Worked example
Derange four objects
There are nine permutations of four objects with no fixed positions.
!4 = 3(!3+!2) = 9
Supported inputs
Precision and limits
Discrete domain
Inputs are whole counts. Negative, fractional, grouped, and scientific-notation inputs are rejected.
Exact integers
Results use arbitrary-precision integers and are never rounded. Inputs and output size are bounded to keep the page responsive.
