Calculate nPr and nCr

Count ordered permutations and unordered combinations from n items choosing r.

freeworks offlinenothing uploaded
ToolPermutation & Combination
Input
Output
Put this on your own site

The frame below runs the same code as this page, in the reader's own browser. Nothing is sent to us, and nothing is sent to you.

Pick a dark background and the text and panels follow it, so the frame stays readable on a dark page.

Preview

How it works

Permutations use n! ÷ (n−r)!, while combinations divide that result by r! to ignore order. Inputs must be integers with 0 ≤ r ≤ n and fit bounded factorial arithmetic.

  • Both counts appear because order determines the formula.
  • The factorial limit is 170.

Worked example

Lottery Combinations
Calculate combinations for choosing 6 from 49
Input
											49, 6
										
Output
												n = 49, r = 6
P(49, 6) = 10068347520
C(49, 6) = 13983816
											

When to use this

Committee counts use combinations, password exercises use ordered selections, and card lessons contrast the two counts.

Edge cases

  • r greater than n is rejected without replacement.
  • n = 0 and r = 0 produce one empty selection.
  • Large factorial operands are limited before overflow.