induwara.lk
induwara.lkEducation · Mathematics

Permutation and Combination Calculator (nPr, nCr)

Work out permutations (nPr) and combinations (nCr) for any whole numbers, with or without repetition. You get the exact count, the factorial formula expanded with your own numbers, and all four standard cases side by side — no signup, no ads, sources cited.

By Induwara AshinsanaUpdated Jun 27, 2026
Permutations & combinations
Exact · BigInt

How many distinct items you choose from.

How many you arrange/pick. Must be ≤ n.

Try a scenario
Permutations (nPr)
60

Formula

P(n, r) = n! / (n − r)!

P(5, 3) = 5! / (5 − 3)! = 5! / 2! = 60

Order matters and items are not reused — use this for ranked outcomes like 1st, 2nd and 3rd place.

5!
120
3!
6
(5 − 3)! = 2!
2

All four cases for n = 5, r = 3

CaseFormulaCount
Permutation, no repetitionP(5, 3)60
Permutation, with repetition125
Combination, no repetitionC(5, 3)10
Combination, with repetitionC(7, 3)35

Formulas follow the NIST DLMF (§5.2, §26.1) and the NIST/SEMATECH e-Handbook §3.3. Counts are computed exactly with BigInt; very large results are shown in scientific notation. Inputs accept whole numbers up to 1,000,000,000.

How it works

A permutation counts arrangements where order matters; a combinationcounts selections where order does not. Whether items may be reused (“with repetition”) splits each of those into two, giving four standard cases. All of them are built from the factorial, defined by n! = n × (n − 1) × … × 2 × 1 with the convention 0! = 1 (NIST DLMF §5.2).

  1. Permutation, no repetition — order matters, each item used once: P(n, r) = n! / (n − r)!. This counts the falling product n × (n − 1) × … × (n − r + 1) (NIST/SEMATECH §3.3).
  2. Permutation, with repetition — order matters, items may repeat: n^r, because each of the r positions is chosen independently from all n items.
  3. Combination, no repetition — order does not matter, each item used once: C(n, r) = n! / (r! · (n − r)!) (NIST DLMF §26.1). Dividing nPr by r! removes the r! orderings that a combination treats as identical.
  4. Combination, with repetition — order does not matter, items may repeat: C(n + r − 1, r), the multiset or “stars and bars” count.

The calculator computes every count with BigInt integer arithmetic, so there is no floating-point error. For combinations it uses the cancellation-based loop ∏ (n − r + i) / i and exploits the symmetry C(n, r) = C(n, n − r), which keeps the work small and the intermediate values exact (each step is itself a whole binomial coefficient). Permutations use the direct falling product rather than dividing two huge factorials. When repetition is off and r exceeds n, the result is 0 — you cannot draw more distinct items than exist, matching the NIST convention C(n, k) = 0 for k > n. The four cases are always shown together so you can see, for the same n and r, how arrangements compare with selections and how repetition changes each.

Worked examples

Lottery selection — C(45, 6)

Combination, no repetition

  1. Order does not matter and numbers are not reused → combination.
  2. C(45, 6) = 45! / (6! · 39!)
  3. Cancellation form: (45·44·43·42·41·40) / (6·5·4·3·2·1)
  4. = 5,864,443,200 / 720
  5. = 8,145,060 possible tickets.

Ranked positions — P(5, 3)

Permutation, no repetition

  1. Order matters (1st, 2nd, 3rd) and no student wins twice → permutation.
  2. P(5, 3) = 5! / (5 − 3)! = 120 / 2
  3. Or directly: 5 × 4 × 3
  4. = 60 ways to fill the three places.

Ice-cream scoops — C(7, 3)

Combination, with repetition

  1. Pick 3 scoops from 5 flavours, repeats allowed, order ignored.
  2. Multiset formula: C(n + r − 1, r) = C(5 + 3 − 1, 3) = C(7, 3)
  3. C(7, 3) = 5,040 / (6 · 24) = 5,040 / 144
  4. = 35 distinct scoop selections.

Frequently asked questions

Sources & references

The formulas and worked examples on this page were last cross-checked against the cited NIST sources on 2026-06-27. Combinatorics here is defined on non-negative integers only, per those conventions.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want to suggest an improvement?

Email me at [email protected] — most fixes ship within 24 hours.