Permutation Calculator (nPr)
Count ordered arrangements: how many ways can r items be lined up when they are drawn from a set of n? This calculator covers both classic permutations nPr, where nothing repeats, and sequences with repetition n^r — think PIN codes — computing each exactly with big-integer arithmetic no matter how many digits the answer has.
Choosing the Right Mode
Without repetition (nPr): each item can appear at most once — runners on a podium, people in a queue, letters of a word rearranged.
With repetition (n^r): every position is filled independently from the full set — digits of a PIN, characters of a password, faces on repeated dice rolls.
How to Use This Calculator
- Pick the mode that matches whether items may repeat.
- Enter n, the number of distinct options available.
- Enter r, the number of positions to fill (without repetition, r must not exceed n).
- Press Calculate to get the exact count, with scientific notation for answers of 30 or more digits.
Related Calculators
Combination Calculator (nCr)
Count combinations exactly with big-integer nCr results, even for very large n.
Percentile Calculator
Find the value at any percentile or a value's percentile rank using linear interpolation.
Mean, Median, Mode Calculator
Find mean, median, mode, range, sum, and count with a full step-by-step solution.
The Two Permutation Formulas
Both modes rest on the multiplication principle: fill the positions one at a time and multiply the number of choices at each step. What changes is whether a used item leaves the pool.
Without repetition: P(n, r) = n! / (n − r)! = n × (n − 1) × … × (n − r + 1)
With repetition: n^r = n × n × … × n (r factors)
Special cases:
- P(n, n) = n! (arrange the entire set)
- P(n, 1) = n
- P(n, 0) = 1 (the empty arrangement)
- P(n, r) = C(n, r) × r!
Without repetition the choices shrink — n options for the first position, n − 1 for the second, and so on — producing the falling product that n!/(n − r)! abbreviates. With repetition the pool never shrinks, so every one of the r positions contributes a full factor of n.
Order Matters: Permutations vs. Combinations
Permutations and combinations answer different questions about the same selection. A permutation counts arrangements: gold to Alice and silver to Bob is a different outcome than the reverse. A combination counts groups: either way, the same two people ended up on the podium. The bridge between them is the identity P(n, r) = C(n, r) × r! — every unordered group of r items can be arranged in exactly r! orders. With n = 52 and r = 5, for instance, C(52, 5) = 2,598,960 five-card hands multiply by 5! = 120 orderings to give P(52, 5) = 311,875,200 ordered deals.
A reliable test: mentally swap two selected items. If the swap produces a genuinely different outcome — positions in a race, characters in a password, seats in a row — you want this page. If the outcome is unchanged — a committee, a lottery ticket, a hand of cards — head to the combination calculator instead.
Passwords, PINs, and the With-Repetition Mode
Codes and passwords allow repeated symbols, so they follow n^r rather than nPr. A 4-digit PIN draws each of its 4 positions from 10 digits: 10^4 = 10,000 possible codes. An 8-character password limited to lowercase letters has 26^8 = 208,827,064,576 possibilities — about 2.09 × 10^11.
These counts translate directly into brute-force effort. Trying one PIN per second, sweeping all 10,000 codes takes 10,000 ÷ 3,600 ≈ 2.78 hours. At 1,000 guesses per second, the full 26^8 password space takes roughly 6.62 years — and each additional character multiplies the space by another factor of 26. In with-repetition mode, r may exceed n for exactly this reason: a 10-character password built from 26 letters is perfectly valid, since symbols can be reused.
Exact Arithmetic Beyond the Factorial Limit
Ordinary JavaScript numbers store integers exactly only up to 2^53 − 1. The last factorial below that ceiling is 18! = 6,402,373,705,728,000; from 19! onward, floating-point arithmetic silently rounds, and by 171! it overflows to infinity. Simple factorial-based tools, including the permutation mode of our probability calculator, inherit those limits.
This page avoids them in two ways. In nPr mode it never computes n! at all — it multiplies only the r factors of the falling product n × (n − 1) × … × (n − r + 1) with big-integer arithmetic, which involves no division and therefore no rounding. In n^r mode it uses exact big-integer exponentiation. Both modes accept n and r up to 2,000: the extreme case 2000! runs to 5,736 digits, and every one of them is displayed.
Worked Example: Filling a Race Podium
Eight sprinters reach a final. How many ways can gold, silver, and bronze be awarded? Order clearly matters, and no runner can take two medals, so use without repetition mode with n = 8 and r = 3.
- Gold: any of the 8 runners.
- Silver: any of the 7 who remain — 8 × 7 = 56 ways so far.
- Bronze: any of the remaining 6 — 56 × 6 = 336 podiums.
The formula agrees: P(8, 3) = 8! ÷ 5! = 40,320 ÷ 120 = 336. And the combination identity checks out too: C(8, 3) = 56 possible medal-winning trios, each of which can be ordered in 3! = 6 ways, and 56 × 6 = 336.
Contrast that with a with-repetition problem: a 4-digit PIN uses n = 10 and r = 4, giving 10 × 10 × 10 × 10 = 10^4 = 10,000 codes — repetition allowed, so the pool never shrinks. Two textbook cases to check your intuition: P(10, 3) = 10 × 9 × 8 = 720 ordered triples from ten items, and P(15, 3) = 15 × 14 × 13 = 2,730.
Frequently Asked Questions
When should I use permutations instead of combinations?
Use permutations whenever rearranging the selected items produces a genuinely different outcome: race finishes, seating orders, passwords, rankings. Use combinations when only membership matters, such as committees or lottery tickets. The two are linked by P(n, r) = C(n, r) x r!, so a permutation count is always the matching combination count multiplied by the r! ways to order each group.
What does the calculator return when r equals n?
P(n, n) = n!, the number of ways to arrange the entire set. For example, P(5, 5) = 120, the orderings of five distinct books on a shelf. In with-repetition mode, n^n counts something different: length-n sequences where symbols may repeat, so 5^5 = 3,125.
Why does with-repetition mode allow r to be larger than n?
Because reused symbols make longer sequences possible: a 10-character password built from 26 letters is one of 26^10 options. Without repetition, each item can fill only one position, so r must stay at or below n; the calculator enforces that rule only in nPr mode.
How does this tool compute large factorials exactly?
It never evaluates n! directly. In nPr mode it multiplies just the r factors from n - r + 1 up to n using big-integer arithmetic, so there is no division and no rounding anywhere. Standard floating-point math becomes inexact after 18! = 6,402,373,705,728,000 and overflows at 171!, but this approach keeps every digit exact for n up to 2,000.
What do permutation counts say about password strength?
The size of the search space is the number an attacker must exhaust. A 4-digit PIN has 10^4 = 10,000 possibilities, swept in under 3 hours at one guess per second. An 8-letter lowercase password has 26^8, about 209 billion, taking roughly 6.6 years at 1,000 guesses per second. Each added character multiplies the space by the alphabet size, which is why length beats complexity tricks.