Work out derangement count instantly with clear inputs, formula shown and shareable results.
A derangement leaves nothing in its original position. Inclusion-exclusion gives Dₙ = n!·Σ(−1)ᵏ/k!, and the ratio Dₙ/n! converges rapidly to 1/e ≈ 0.3678794.
Derangement count
Dₙ = n·Dₙ₋₁ + (−1)ⁿ = n!·Σₖ₌₀ⁿ (−1)ᵏ/k!
Exactly k fixed
C(n, k) · D₍ₙ₋ₖ₎
14833 out of 40320 permutations, a probability of 0.3678792 — already matching 1/e to six decimals.
Drawing names so nobody gets themselves is exactly a derangement, and the chance of a valid random draw is about 37%.