Derangement Calculator
Count permutations in which no item stays in its original position.
How the derangement calculator works
A derangement is a permutation in which no labeled item remains in its original position, as in returning letters to the wrong envelopes. The exact recurrence multiplies n minus one by the sum of the two preceding derangement counts. This calculator builds that recurrence from the empty and one-item base cases and compares the result with all n factorial permutations.
For the default n equal to 5, the recurrence advances from 1 and 0 to 1, 2, 9, and the verified value 44. There are 120 total permutations of five labeled items, so about 36.67 percent are derangements. That fraction approaches one divided by e as n grows, but the displayed count is exact.
Reading derangement calculator results privately
The calculator counts fully labeled items and forbids every fixed point; it does not handle repeated indistinguishable items or partial restrictions. Input is capped at 18 to keep both factorial and recurrence values exact in safe integer arithmetic. The empty permutation is counted as one derangement by the standard combinatorial base convention. This derangement calculator calculation runs entirely in your browser, so the numbers you enter never leave your device.
Frequently Asked Questions
Why is the derangement of zero equal to one?
There is exactly one empty permutation, and it vacuously has no item in a fixed position.
Why does the derangement share approach one over e?
Inclusion-exclusion yields a truncated alternating expansion of e to the minus one.
Is the derangement calculator private?
Yes. Its inputs and results stay in your browser. Bushe.co does not upload or store the values used in this calculation.
Browse the full set of free, private, in-browser tools.