How to Use
Enter n:
- n: Number of elements
- D(n): Derangement count
- P: Probability
Formula
Inclusion-exclusion: D(n) = Σₖ₌₀ⁿ(−1)ᵏC(n,k)(n−k)! = n!Σ(−1)ᵏ/k!. Nearest integer: D(n) = round(n!/e). Also: D(n) = (n−1)(D(n−1)+D(n−2)).
Applications
- Hat-check problem
- Secret Santa assignments
- Card shuffling analysis
- Cryptographic permutations
Step-by-Step Instructions
- 1Enter n.
- 2Get D(n).
- 3View probability.
- 4See recurrence.
- 5Check table.