Math & Science· 5 min read

Permutation and Combination Calculator: nPr and nCr with BigInt

Enter n and r to instantly compute permutations, combinations, and their underlying factorial values using arbitrary-precision arithmetic.

By EasyMath Team Last updated: 2026-08-23.

Why this matters

Combinatorics is the mathematical foundation for probability, statistics, cryptography, and algorithm analysis, yet the core operations — permutations and combinations — are simple formulas that become computationally explosive as inputs grow. The number of ways to arrange 52 cards is 52 factorial, a number with 68 digits that overflows standard 64-bit floating point. A calculator that uses JavaScript's BigInt type handles this without any loss of precision, letting you explore combinatorial questions at any scale without worrying about integer overflow or scientific notation rounding.

The distinction between permutations (order matters) and combinations (order does not) is a source of frequent confusion, even among experienced practitioners. If you are selecting a president, vice-president, and treasurer from a group of 10 people, the order of selection matters and you need permutations. If you are choosing 3 people to form a committee, the order does not matter and you need combinations. Showing both results side by side for the same n and r makes the difference immediately tangible.

See it in action

Formula reference

ConceptFormulaExample (n=5, r=2)Result
Permutation (nPr)n! / (n-r)!5! / 3! = 120 / 620
Combination (nCr)n! / (r! * (n-r)!)5! / (2! * 3!) = 120 / 1210
Factorial (n!)n * (n-1) * ... * 15!120
r > nNot possiblenPr = nCr = 00

How to use it

Enter n (the total number of items) and r (the number of items to choose) in the input fields.

View the permutation (nPr) and combination (nCr) results that update instantly as you type.

The factorial values of n, r, and (n minus r) are displayed below the results for mathematical context.

Try large values — BigInt arithmetic means you can compute n=1000 or higher without overflow.

Compare nPr and nCr for the same inputs to see how much order affects the count.

Testing your result

Verify the calculator with small known values. For n=5 and r=2, permutations should be 20 and combinations should be 10. Check the factorials: 5! = 120, 2! = 2, and 3! = 6, confirming 120/6 = 20 for nPr and 120/(2 times 6) = 10 for nCr. Test the edge case where r equals n: for n=4, r=4, nPr should equal nCr should equal 1. Test r greater than n: for n=3, r=5, both results should be 0. For a large input, try n=100, r=50 and confirm the result is a full integer with no scientific notation.

Common mistakes

Confusing permutations with combinations — if the arrangement order matters (seats, rankings, passwords), use nPr; if only the group membership matters (teams, committees, subsets), use nCr.

Expecting nPr and nCr to be equal when r is 1 or n — they are equal when r=0, r=1, and r=n, but differ for all other values.

Using floating-point calculators for large inputs, which produce inaccurate results due to 64-bit overflow around n=21.

Forgetting that nCr is always less than or equal to nPr for the same n and r, since combinations ignore order and thus group multiple permutations together.

Entering negative numbers — the tool expects non-negative integers for both n and r.

Edge cases and options

The BigInt implementation is the critical technical feature here. Standard JavaScript numbers lose integer precision above 2 to the power of 53 (approximately 9 quadrillion), which means a factorial as small as 18! produces an imprecise result with regular number types. By using BigInt, the calculator handles n values in the hundreds or even thousands and returns exact full integers. When r exceeds n, both nPr and nCr correctly return 0 since you cannot choose more items than exist. The factorial values of n, r, and (n minus r) are shown to help you follow the calculation and verify the result manually for smaller inputs.

Real-world use cases

Calculating the number of possible passwords from a character set of size n choosing r characters where order matters (permutations).

Determining lottery odds by computing combinations: choosing 6 numbers from 49 is C(49, 6), giving the total number of possible tickets.

Computing the number of possible starting lineups for a sports team when selecting r players from a roster of n.

Analyzing algorithm complexity by computing how many possible orderings or subsets exist for a given input size.

Calculating poker hand probabilities using combinations to count the number of ways to draw each hand type from a 52-card deck.

Frequently asked questions

Q: What is a permutation?

A: A permutation is an ordered arrangement. The formula nPr = n! / (n-r)! counts how many ways to pick r items from n where the sequence matters. P(5, 2) = 20.


Q: What is a combination?

A: A combination is an unordered selection. The formula nCr = n! / (r! * (n-r)!) counts how many ways to pick r items from n where order does not matter. C(5, 2) = 10.


Q: How are factorials computed?

A: Using JavaScript BigInt, so very large inputs (n = 1000 or more) work without overflow. Results are displayed as full integers with no scientific notation.


Q: What if r is greater than n?

A: Both nPr and nCr return 0. You cannot choose more items from a set than the set contains.


Q: When are nPr and nCr equal?

A: They are equal when r = 0, r = 1, or r = n. In all other cases, nPr is strictly greater than nCr because order creates additional distinct arrangements.


Q: What is the largest n I can use?

A: There is no practical hard limit due to BigInt arithmetic, but computing very large factorials (n above 10,000) may take noticeable time. For most practical uses, n up to a few hundred is instantaneous.

Start using it now

Try the Permutation & Combination Calculator tool. See also Probability Calculator, Fibonacci Generator, and Prime Number Generator.

Need help using this tool?

Read our complete Permutation & Combination Calculator tutorial for step-by-step guidance.

Ready to try the tool?

No accounts. No uploads. No limits. Start now.