Statistics

Combination & Permutation Calculator

What this does

Compute C(n,r) combinations and P(n,r) permutations together, with exact loop-product arithmetic for large n.

Enter your details

Runs in your browser

Calculator inputs

Using the combination & permutation calculator

  1. 01

    Set n and r

    n is how many items exist; r is how many you pick.

  2. 02

    Read both answers

    The main number is C(n,r); the permutation row gives P(n,r) for ordered scenarios.

  3. 03

    Choose which applies

    Lotteries, committees and hands are combinations; rankings, passwords and race finishes are permutations.

Combinations or permutations?

Ask one question: would swapping two chosen items create a new outcome? A poker hand stays the same hand when reordered; combination. A podium finish changes meaning when gold and silver swap; permutation.

Why no factorial blowups

Directly computing 1000! overflows any floating-point format. Multiplying r ratios one at a time keeps every partial product a modest integer, which is why C(1000,3) computes instantly and exactly here.

  • C(n,0) = C(n,n) = 1 always.
  • P(n,r) = C(n,r) × r!
  • r > n is rejected as impossible.

The math behind this calculator

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

Combinations count unordered selections; permutations count ordered arrangements; same items, r! times as many results. Both are computed via running products rather than literal factorials, so intermediate values stay small and exact even for huge n where n! would overflow IEEE doubles (beyond 170!).

Validation enforces non-negative whole numbers with r ≤ n. Edge cases behave sensibly: choosing everything or nothing yields exactly one combination.

Assumptions & limitations

  • n and r must be non-negative integers.
  • Items are distinct; no repetition allowed within a selection.
  • Order distinguishes permutations from combinations.

Worked example

A 5-card poker hand from a 52-card deck: 2,598,960 combinations; but 311,875,200 permutations once card order is considered.

Frequently asked questions

What if order does not matter but repeats are allowed?
That is combinations with repetition: C(n+r−1, r); compute it here by substituting those adjusted arguments.
How large can n be?
Very large; the loop-product method avoids factorial overflow entirely. Only astronomically large exact results exceed floating-point integer precision beyond 2⁵³.
Why does r ≤ n matter?
You cannot choose more distinct items than exist; requesting r > n has no mathematical answer and returns an error.
Is C(n,r) always an integer?
Yes; it counts selections. The incremental division in the loop product preserves this exactly.

Related calculators