Counting without listing every outcome
Combinatorics asks how many arrangements or selections are possible. Listing outcomes works for tiny examples, but the count grows too quickly for enumeration. Permutation and combination formulas give the total directly.
The first question is whether order matters. The second is whether an object can be selected more than once. Those two choices determine the formula.
This calculator reports four common cases: ordered selection without repetition, unordered selection without repetition, ordered sequences with repetition, and unordered selections with repetition.
Factorials
The factorial of a non-negative integer n is the product of every positive integer through n:
n! = n × (n−1) × (n−2) × … × 2 × 1
For example, 5! = 5 × 4 × 3 × 2 × 1 = 120.
Zero factorial is defined as 1. There is exactly one way to arrange no objects: the empty arrangement. The definition also keeps identities such as C(n,0) = 1 and n! = n × (n−1)! valid at the boundary.
Factorials grow extremely fast. Twenty factorial is already 2,432,902,008,176,640,000. Exact integer arithmetic is necessary when the full count matters.
Permutations without repetition
A permutation counts ordered selections of r distinct objects from n:
P(n,r) = n! ÷ (n−r)!
The factorials cancel, leaving r descending factors:
P(n,r) = n × (n−1) × … × (n−r+1)
Suppose ten runners compete for gold, silver, and bronze. There are ten choices for gold, nine remaining choices for silver, and eight for bronze. The count is 10 × 9 × 8 = 720.
Order matters because the same three runners receiving different medals is a different outcome.
Combinations without repetition
A combination counts unordered selections of r distinct objects from n:
C(n,r) = n! ÷ [r!(n−r)!]
Choosing three committee members from ten gives C(10,3) = 120. Each committee appears 3! = 6 times among the 720 ordered selections, once for every internal order. Dividing permutations by 6 removes those duplicates.
Combinations satisfy a symmetry:
C(n,r) = C(n,n−r)
Choosing three people to include is equivalent to choosing seven to leave out. The calculator uses the smaller of r and n−r to compute the value efficiently.
How to decide whether order matters
Ask whether swapping the selected objects changes the outcome. A password, race ranking, seating order, and sequence of tasks change when positions swap, so they use permutations.
A committee, lottery set, hand of cards, and chosen feature set normally do not change when listed in another order, so they use combinations.
Labels can create order even without a physical line. Assigning three people to three different jobs is a permutation because the roles distinguish positions. Selecting three people for identical membership is a combination.
Ordered selections with repetition
When each of r positions can independently use any of n objects, the count is:
n^r
A four-digit code using ten digits has 10^4 = 10,000 possible sequences when leading zero and repeated digits are allowed. Each position has ten choices, and the multiplication rule combines them.
If repetition is forbidden, the same code-shaped selection has P(10,4) = 5,040 outcomes. Clarifying replacement or repetition can therefore change the answer substantially.
Combinations with repetition
For an unordered selection of r items from n types where a type can appear multiple times, the count is:
C(n+r−1,r)
This is the stars-and-bars formula. Imagine r identical stars representing selected items and n−1 bars separating them into categories. Arranging the stars and bars determines how many of each type were selected.
Choosing six identical scoops among four flavours, where only the number of each flavour matters, gives C(4+6−1,6) = C(9,6) = 84.
If individual scoops are ordered in a sequence, use 4^6 instead. Again, order is the deciding question.
Worked selection example
A class has 12 students and needs a four-person group. If every member has the same status:
C(12,4) = 495
If the group has four distinct positions—leader, recorder, presenter, and reviewer—the count is:
P(12,4) = 12 × 11 × 10 × 9 = 11,880
There are 4! = 24 role assignments for every four-person group, and 495 × 24 = 11,880.
Worked probability example
A standard deck has 52 cards. The number of five-card hands is C(52,5) = 2,598,960 because hand order does not matter.
To count hands containing exactly two aces, choose two of the four aces and three of the 48 non-aces:
C(4,2) × C(48,3) = 6 × 17,296 = 103,776
The probability is favourable combinations divided by total combinations: 103,776 ÷ 2,598,960, about 3.9937%.
This example also shows that complex counts are often products of smaller independent choices.
Restrictions change the formula
Basic formulas assume every object is available for every relevant choice. Restrictions may require splitting the problem into cases, subtracting forbidden outcomes, or using inclusion-exclusion.
If a five-character code must include at least one digit, count all allowed-character codes and subtract codes containing no digits. Counting the complement is often simpler than counting every valid case directly.
If two people cannot serve together on a committee, calculate all committees and subtract those containing both. The subtracted count fixes those two members and chooses the remaining places from everyone else.
The calculator does not model custom restrictions; it supplies the standard building blocks.
Circular permutations
Arranging n distinct objects around a circle differs from arranging them in a line. Rotating everyone together does not create a new relative order, so fix one object as an anchor and arrange the rest:
circular arrangements = (n−1)!
If mirror images are also considered the same, as with an unoriented necklace, an additional division by two may apply for distinct objects. Symmetry and repeated patterns can make necklace counting more complicated.
The nPr result from this calculator describes linear ordered selections, not equivalence under rotation or reflection.
Repeated objects in arrangements
If a full arrangement contains repeated indistinguishable objects, divide by the factorial of each repetition count:
n! ÷ (a!b!c!…)
The letters in LEVEL have five positions with L repeated twice and E repeated twice. The number of distinct arrangements is 5! ÷ (2!2!) = 30.
Treating identical copies as distinct would count visually identical arrangements several times. This case differs from selecting with replacement and is not one of the four direct outputs.
Exact integers and display size
Counting results are whole numbers. Floating-point approximations can lose units once results exceed the safe-integer range. The calculator uses arbitrary-precision integers and never routes the count through a decimal approximation.
For very large results, the display shortens the middle while reporting the digit count. The computation itself remains exact. Inputs are limited to n of 500 to keep output and browser work practical.
Scientific notation can be useful for scale but is not suitable when the exact count is required for modular arithmetic, enumeration boundaries, or a proof.
Common mistakes
The most common mistake is choosing permutation because the selected items are written in a list, even though rearranging the list does not change the outcome. Written order is not necessarily meaningful order.
Another is using n^r when repetition is forbidden. Independent choice at every position assumes previously selected objects remain available.
A third is forgetting that roles create distinct positions. “Choose a chair and deputy” is ordered even if the two names are later printed alphabetically.
Finally, factorial cancellation should be done before numeric approximation. Computing huge factorials as floating-point numbers and dividing them can overflow or round an integer result.
Limits of the calculator
The tool handles standard selections from n types or distinct objects with n and r between zero and 500 and r no greater than n for the without-repetition cases.
It does not directly handle circular symmetry, repeated indistinguishable objects in a full arrangement, custom exclusions, adjacency rules, minimum counts, or probability weighting. Those problems can often be assembled from combinations, products, sums, and complementary counting.
Use the output as an exact count under the stated assumptions. Before applying it, describe what makes two outcomes different and whether a selected object returns to the available pool.