Factorial, Permutation and Combination Calculator
Calculate n factorial, permutations P(n, r) and combinations C(n, r) exactly (no rounding) for n and r up to 21; a flag shows when r is greater than n.
Things to keep in mind:
- Only selection without repetition is computed; when items may repeat (e.g. n^r) the results differ.
- n and r are limited to 21; larger values are not supported.
- Circular permutations, permutations with identical items and multi-group selections need different formulas.
Calculator
Result
Enter the values and press Calculate to see the result here.
About this tool
This tool computes the three basic counting values as exact integers: factorial, permutation and combination (n and r up to 21).
Formulas
- Factorial: n! = 1 × 2 × 3 × … × n, with 0! = 1
- Permutation (order matters): P(n, r) = n! / (n − r)!
- Combination (order does not matter): C(n, r) = n! / (r! × (n − r)!)
Permutations and combinations count the ways to pick r items from n without repetition. Ranking the top three in a race is a permutation; choosing three people for a committee is a combination. Each combination corresponds to r! orderings, so C(n, r) = P(n, r) / r!.
Example: for n = 5 and r = 3, 5! = 120, P(5, 3) = 5 × 4 × 3 = 60 and C(5, 3) = 60 / 6 = 10. If r is greater than n (for example n = 10, r = 12) no selection is possible: P and C show 0 and "valid selection" is 0.
Since 21! is about 5.11 × 10²⁰, results are shown as exact integers without rounding. Larger n would need logarithmic or approximate methods.
How to use
- Enter the total number of items as n (0-21).
- Enter the number of items to choose as r (0-21).
- Click Calculate to see n!, r!, P(n, r) and C(n, r).
Notes
All results are exact integers with no rounding. n and r can be at most 21; 21! = 51,090,942,171,709,440,000. When r > n, permutations and combinations show 0. Permutations or combinations with repetition and circular arrangements are not computed.
Frequently asked questions
In a permutation the order of the chosen items matters (ABC differs from CBA); in a combination it does not. Hence C(n, r) = P(n, r) / r! is always less than or equal to P(n, r).
An empty product is defined as 1, and there is exactly one way to arrange zero items. The convention keeps formulas consistent, for example C(n, 0) = 1.
You cannot choose more than n items without repetition. The tool shows 0 for P and C and sets "valid selection" to 0.
21! = 51,090,942,171,709,440,000 has 20 digits, the largest factorial the calculation engine can show exactly; 22! has 21 digits.
For choosing 6 of 49 numbers, C(49, 6) = 13,983,816, but since n is limited to 21 here this example cannot be computed directly.
Next step
Related tools to continue your calculation.
- Calculate
Exponent and Root Calculator (Power, Square Root, Cube Root, n-th Root)
Raise a number to any power (including fractional and negative exponents) and take its square root, cube root and n-th root.
- Calculate
Logarithm Calculator (log, ln, log2 and Antilog)
Calculate the logarithm of a number in any base, its natural (ln), common (log10) and binary (log2) logarithm, and the antilogarithm.
- Calculate
Mean and Standard Deviation Calculator
Calculate the sum, arithmetic mean, population and sample variance, standard deviation, coefficient of variation, minimum, maximum and range of 2 to 10 numbers.
- Calculate
Percentage and Change Calculator
Calculate a percentage of a number, the ratio and percent change between two numbers, increase or decrease a number by a percentage, and work backwards to the whole.
- Calculate
Direct and Inverse Proportion Calculator
Find the unknown X and the proportionality constant in a direct proportion A / B = C / X or an inverse proportion A × B = C × X.