ScienForge

Permutations and combinations calculator

Compute nPr, nCr, factorials and the number of arrangements with and without repetition allowed.

Combinations nCr (order does not matter)
120
Permutations nPr (order matters)720
With repetition, ordered (nʳ)1000
With repetition, unordered220
n!3.628800000e+6
r!6

Counting problems come down to a single diagnostic question: does the order of the selection matter? If it does, you want permutations. If it does not — if rearranging the same items counts as the same outcome — you want combinations. Nearly every confusion in this topic traces back to skipping that question and guessing at a formula instead.

nPr = n! / (n − r)!   nCr = n! / (r!(n − r)!)

A worked distinction between the two

Choosing three people from a group of ten to be president, secretary and treasurer specifically is a permutation problem: 10P3 = 720, because assigning the same three people to different roles produces a genuinely different outcome — swapping who is president and who is secretary matters. Choosing the same three people from ten simply to form an unranked committee is a combination problem: 10C3 = 120, because a committee of Alice, Bob and Carol is identical to a committee of Carol, Bob and Alice — there is no role attached to distinguish the orderings. Notice the permutation count is always exactly r! times larger than the combination count (720 / 120 = 6 = 3!), because r! is precisely the number of ways to reorder any given group of r chosen items, and permutations count every one of those reorderings as distinct while combinations collapse them into one.

Repetition changes the entire calculation

Everything above assumes each item can be chosen at most once. If items can be reused — digits in a PIN code, letters in a password, dice rolled multiple times — the count becomes n^r instead, since every one of the r positions independently has all n options available regardless of what was already chosen. A four-digit PIN allowing repeated digits has 10⁴ = 10,000 possible combinations, but a four-digit code where no digit may repeat has only 10P4 = 5,040 — nearly half as many. This is precisely why security guidance sometimes discourages repeated characters in passwords: repetition does not reduce the search space at all in the way people intuitively expect, since 10,000 versus 5,040 is not actually a large difference relative to how brute-force guessing scales with total length.

Combinations are the same thing as binomial coefficients

nCr is not merely related to the binomial coefficient — it is the binomial coefficient, the number that appears as the coefficient of xʳ when expanding (1 + x)ⁿ algebraically. It is also exactly the entries found in Pascal’s triangle, where each row corresponds to a fixed n and each position along the row corresponds to r. This is not a coincidence or an analogy — the combinatorial definition (ways to choose r items from n) and the algebraic definition (a coefficient in a polynomial expansion) are provably the same quantity, which is part of why combinations turn up constantly throughout probability theory, genetics (Punnett square combinatorics), and computer science (counting possible subsets or hash collisions).

Why factorials grow so explosively

Factorials grow far faster than exponential functions, which is why this calculator caps n at 170 — beyond that, 171! already exceeds the largest number a standard double-precision floating point number can represent, producing infinity rather than a real answer. 10! is 3,628,800; 20! is already over 2.4 quintillion. This explosive growth is the mathematical reason that problems like the travelling salesman problem (which naively requires checking (n−1)! possible routes) become computationally intractable for even moderately large n — 20 cities alone would require checking more routes than there are seconds since the Big Bang.

Related calculators