SuperDevTools

Combination and permutation calculator (nCr and nPr)

n and k: whole numbers from 0 to 10,000. Results are exact, never rounded.

Examples

Permutations of identical items

Enter how many times each item repeats (for example 2 2 1 1), or type a word to count its anagrams.

Everything is calculated in your browser; your last values are saved on this device.

How many ways can you choose k items from n?

This combination calculator gives nCr, written C(n, k) and also known as the binomial coefficient, together with permutations nPr, factorials and their versions with repetition. Every result is an exact whole number up to n = 10,000: C(1000, 500) is shown with all 300 digits and in scientific notation (≈ 2.702882 × 10299). It also works out the odds of matching j numbers in a draw, lists every combination of a short list and draws Pascal's triangle.

How to use it

  1. In the "Combinations and permutations" tab, enter "n (number of items)" and "k (items chosen)", or click an example such as "6 from 49".
  2. Read the six cards: "Combinations", "Permutations", "Factorial", "Combinations with repetition", "Permutations with repetition" and "Odds of drawing one specific combination". Each card shows the formula, the working and a "Copy" button.
  3. For identical items, fill in "Count of each item" or "Or a word": BANANA (B, A × 3, N × 2) has 6! ÷ (3! × 2!) = 60 distinct arrangements.
  4. In "Probabilities", set "Numbers in the pool (N)", "Numbers drawn" and "Numbers picked".
  5. In "List combinations", type your items and a "Group size (k)": up to 2,000 lines are listed.

Combination vs permutation: the formulas

A combination is a group where order does not matter: {A, B, C} and {C, A, B} count once. A permutation (nPr, sometimes called an arrangement) is an ordered selection: gold, silver and bronze for the same three runners in a different order is a different podium.

  • Combinations: C(n, k) = n! ÷ (k! × (n − k)!). Example: C(49, 6) = 13,983,816.
  • Permutations: P(n, k) = n! ÷ (n − k)!. A podium of 3 from 10 runners: 10 × 9 × 8 = 720.
  • Factorial: n!. Ten books on a shelf can be lined up in 10! = 3,628,800 ways.
  • Permutations with repetition: nk. A 4-digit PIN: 104 = 10,000 codes.
  • Combinations with repetition: C(n + k − 1, k). Three scoops from 5 ice cream flavors, repeats allowed: C(7, 3) = 35.

The two are linked by P(n, k) = C(n, k) × k!, because each group of k items can be ordered in k! ways. For 3 from 10: 120 combinations × 6 orders = 720 permutations. A poker hand of 5 cards from 52 is a combination: C(52, 5) = 2,598,960.

Odds for a draw of 6 numbers from 49

The chance of matching exactly j numbers follows the hypergeometric distribution: C(6, j) × C(43, 6 − j) ÷ C(49, 6). Here is the exact table for one ticket of 6 numbers:

MatchesCombinationsProbabilityOdds, 1 in
06,096,4540.43596497552.29
15,775,5880.41301945052.42
21,851,1500.13237802907.55
3246,8200.017650403956.66
413,5450.00096861971,032.40
52580.000018449954,200.84
610.000000071513,983,816

The "At least this many" column adds up the rows below: 3 or more matches comes to about 1 in 54.

FAQ

What is C(n, 0)?

Always 1: there is exactly one way to choose nothing. Likewise 0! = 1, and C(n, k) = C(n, n − k).

Why is the answer 0 when k is bigger than n?

Without repetition you cannot pick 7 items from 5. The versions with repetition are still calculated.

How large can the numbers get?

n and k go up to 10,000. 10,000! has 35,660 digits, all shown and ready to copy. Scientific notation is rounded to 7 significant digits.

How do I list every combination of A, B, C, D, E taken 3 at a time?

In "List combinations", keep A, B, C, D, E and k = 3: the tool shows the 10 groups, from A, B, C to C, D, E. Then use "Copy the list".