Mathematics

Counting formulas for selections and arrangements. Enter n and r to get the standard textbook counts, including the cases with repetition.

This page is for the standard counting formulas: how many ways to choose r items from n, with or without regard to order, and with or without repetition, as the tool describes.

It is a textbook counter, not a probability engine and not a tutorial on generating functions. If the problem is about arrangements with extra restrictions (no two adjacent, circular tables, and so on), those restrictions are not built in.

Counting combinations and permutations

Open Combinations and permutations when you have n and r and you want C(n, r), P(n, r), or the repetition cases the page lists. For grade arithmetic see Grades.

Order, repetition, and the size of n

A permutation cares about order; a combination does not. With repetition allowed, the formulas change (stars-and-bars for combinations with repetition, n^r for permutations with repetition). The calculator uses those standard identities and refuses inputs that would make them undefined, such as a negative r.

The numbers grow quickly. A result with dozens of digits is still a count, not a probability, until you divide by the size of the sample space yourself.

Using C when the problem cares about order

If a PIN or a finishing order matters, you want a permutation, not a combination. If an item can be reused, you want a with-repetition formula. Read the problem for those two words before you pick a line on the page.

Questions about the counting calculator

Is 0! treated as 1?

Yes, in the usual convention that makes C(n, 0) = 1. The page follows that convention.

Can I get a probability of a poker hand from this?

You can get the counts, then divide by the relevant total. The calculator will not apply a card-deck model for you.

What if r is larger than n without repetition?

Ordinary combinations and permutations are zero or refused in that case, because you cannot choose more distinct items than you have.