nPr (Permutations): The number of ways to arrange r items out of n when order matters — for example, first, second, and third place finishes from a pool of contestants.
nCr (Combinations): The number of ways to choose r items from n when order does not matter — for example, picking a committee of three people from a group.
n! and r!: The factorial values used in the formulas. Factorials grow extremely fast — 20! is roughly 2.4 × 10¹⁸ — so large inputs may display in scientific notation.
When nPr equals nCr: This happens when r = 0 or r = 1, meaning there is only one way or order is irrelevant at that size.
How This Calculator Works
You enter n (total items) and r (items chosen). The calculator computes n!, r!, and (n−r)! using iterative multiplication, then applies the standard permutation formula nPr = n! / (n−r)! and the combination formula nCr = n! / (r!(n−r)!). It assumes non-negative integers with r ≤ n. Results beyond about 15 significant digits may lose exact integer precision due to JavaScript floating-point limits.
Quick Questions
When should I use permutations vs. combinations?
Use permutations when the arrangement order matters — rankings, seating charts, passwords. Use combinations when order is irrelevant — lottery draws, committee selections, choosing toppings.
Why do large inputs show "Infinity"?
JavaScript uses 64-bit floating-point numbers, which overflow to Infinity around 170!. For values this large, specialized arbitrary-precision libraries are needed.
What does 0! equal and why?
By convention, 0! = 1. This is because there is exactly one way to arrange zero items: do nothing. The convention also keeps the combination and permutation formulas consistent.
Can I use this for lottery odds?
Yes. Most lotteries are combinations — the order the balls are drawn doesn't matter. Enter the total number of balls as n and the number drawn as r, then nCr gives you the number of possible outcomes.