Combinatorics Calculator

Enter n (the total items) and r (how many you're choosing or arranging) — both results update as you type.

How it works

Permutations (nPr) count arrangements where order matters — first, second and third place among 5 runners is 5P3 = 60 distinct outcomes. Combinations (nCr) count selections where order does not matter — picking any 3 of those same 5 runners for a team is only 5C3 = 10, since who's "first" no longer counts for anything.

Both are computed without ever forming a full factorial: nPr multiplies only the r terms that survive the cancellation in n!/(n-r)!, and nCr multiplies and divides one step at a time so the running value is always an exact whole number, never a private fraction. That keeps n well into the dozens comfortably inside a value JavaScript can represent exactly — n! itself would overflow long before n gets anywhere near that far.