Derangement (subfactorial) calculator !n
Compute the subfactorial !n — the number of derangements, permutations of n items in which nothing stays in its original place. It uses the exact recurrence !n = (n−1)·(!(n−1) + !(n−2)) with big integers, and shows the ratio !n / n!, which converges astonishingly fast to 1/e ≈ 0.3679. That ratio is the probability that a random shuffle leaves no element fixed — the classic 'hat-check' problem.
Related tools
All Combinatorics tools →Need !n (derangements), n!, !n / n! (→ 1/e)? The Derangement (subfactorial) calculator !n derives it from n (0 to 1000) in one step. For instance, with n (0 to 1000) = 5 it returns !n (derangements) = 44, n! = 120 and !n / n! (→ 1/e) = 0.367.
How to use it
- Enter your values: n (0 to 1000).
- Read the result instantly: !n (derangements), n!, !n / n! (→ 1/e).
Frequently asked questions
What does the Derangement (subfactorial) calculator !n actually compute?
It takes n (0 to 1000) and derives !n (derangements), n! and !n / n! (→ 1/e) from them. The calculation is live as you type, so the result updates on every change.
What information do I need to provide?
A single value: n (0 to 1000). Nothing else is required — no account, no file upload.
Can you show a worked example?
With n (0 to 1000) = 5, the calculator returns !n (derangements) = 44, n! = 120 and !n / n! (→ 1/e) = 0.367. Those figures come from running this exact tool, so you can reproduce them by entering the same values.
What happens if I enter larger values?
It moves a lot. Using n (0 to 1000) = 10 instead, !n / n! (→ 1/e) goes from 0.367 to 0.368 — which is why it is worth testing a few scenarios rather than trusting a single figure.
What does it give for smaller values?
Scaled down to n (0 to 1000) = 3, !n / n! (→ 1/e) comes out at 0.333. The relationship is worth checking at both ends before you rely on a single result.
When would I actually use this?
Counting possibilities before enumerating them: hands in a card game, passwords of a given shape, seatings around a table, or lottery odds.
What is the most common mistake?
Choosing a permutation when order does not matter. Picking three people from ten gives 720 arrangements but only 120 groups — the two differ by a factor of six here, and far more as the numbers grow.
Where do the figures come from, and how current are they?
Counting formulas are exact by definition. Large factorials are computed with arbitrary precision where needed, so a result is not silently rounded into scientific notation.