Short title
Badge zero server

Permutation & Combination Calculator

Calculate permutations (nPr) and combinations (nCr) with or without repetition. Features step-by-step factorials, item list generator, and lottery odds.

100% Client-Side Privacy
Presets label
Regime label
Mode label

Repetition desc distinct

49
050Slider cap hint
6
Kpi primary resultC(n, r) = n! / [r! * (n - r)!] = 49! / [6! * (49 - 6)!]
13,983,816
Kpi odds badgeLbl one in 13,983,816
Lbl percentage chance7.151e-6%
Kpi entropy bits23.74 Unit bits
Card n pr title
10,068,347,520n! / (n - r)!
Card n cr titleLbl active selection
13,983,816n! / [r! * (n - r)!]
Card p r title
13,841,287,201n^r
Card c r title
25,827,165C(n + r - 1, r)
Title binomial curve
Lbl population n n = 49Lbl current selection = 6
k = 0k = 25 (Peak)k = 49

Desc pascal slice

Lbl comparison ratio
Card n pr title33.2 Unit bitsCard n cr title23.7 Unit bitsCard p r title33.7 Unit bitsCard c r title24.6 Unit bits

Lbl keyspace tooltip

Stat total outcomes13,983,816
Stat entropy bits23.74 Unit bits
Stat precision engineVal arbitrary big int
Technical Reference & Architecture Guide

Permutation & Combination Calculator Guide

Calculate permutations (nPr) and combinations (nCr) with or without repetition. Features step-by-step factorials, item list generator, and lottery odds.

Permutation & Combination Calculator Guide — Client-Side In-Memory Architecture & Data Flow
Permutation & Combination Calculator Guide — Client-Side In-Memory Architecture & Data Flow

Key Parameters & Controls

Total Population or Pool Size (n)Count (Whole Non-Negative Integer)

The total number of available items, choices, or distinct members in a collection from which you select or organize. In everyday selections without repeats (such as picking teammates or drawing lottery balls), your selection size r cannot exceed this total pool (r ≤ n). When items can be chosen multiple times (such as rolling a die or choosing frozen yogurt toppings), n represents the variety of distinct options available.

Default: n = 10 (Customizable from 0 to 10,000)
Sample Subset Size (r or k)Cardinality / Group Size (0 ≤ r ≤ n)

The exact number of slots to fill or items to choose from the pool. When the sequence matters (such as awarding 1st, 2nd, and 3rd place running medals), r represents the positions in a permutation P(n, r). When group composition is all that counts (such as picking a 3-person volunteer squad), r represents the group size in a combination C(n, r). Setting r = 0 always equals 1, representing the single way to leave all items unselected.

Default: r = 3 (Customizable from 0 to n)
Order Sensitivity & Replacement Flag (isOrdered, withReplacement)Arrangement Logic & Replacement Mode

Establishes counting rules across two practical questions: First, does order matter? In permutations, sequence counts (finishing 1st then 2nd is distinct from 2nd then 1st). In combinations, order is irrelevant (a fruit bowl of apples and bananas is identical to bananas and apples). Second, can choices be repeated? Without replacement means each item can be picked once; with replacement means items return to the pool for reuse.

Default: Order: Irrelevant (Combinations) | Replacement: Disabled
Multinomial Frequency Partitions (n1, n2, ... nk)Subgroup Partition Counts (Sum = n)

Used when arranging a group where certain items are identical to one another, such as rearranging the letters in 'CHEESE' or sorting red and blue sports jerseys. The multinomial calculation n! / (n1! × n2! × ... × nk!) divides out the unnoticeable swaps between identical items, providing the exact number of distinct, visually unique arrangements.

Default: Uniform Distinct Items (n1 = n2 = ... = nk = 1)
Derangement Subfactorial Operator (!n)Subfactorial Integer Sequence

Calculates complete reshuffles where not a single person or item ends up in their starting position—the classic rule of a Secret Santa gift exchange or returning winter coats to the wrong owners. As the group size grows beyond 4 people, the probability that a completely random swap leaves nobody with their own item rapidly settles at approximately 1/e (~36.79%).

Default: !n = floor(n! / e + 0.5) for n ≥ 1
Keyspace Entropy & Security Complexity (H = log2(S))Entropy Measure in Bits

Measures the total unpredictability and difficulty of guessing a sequence in binary bits (H = log2(Total Possibilities)). In personal digital safety, higher bit entropy means exponentially stronger defense against guessing attacks: a 6-digit numeric passcode (10^6) provides only ~19.9 bits of security (cracked in fractions of a second), whereas a 12-character passphrase chosen from letters, numbers, and symbols delivers ~78.6 bits of robust protection.

Default: H = log2(Total Outcomes) Bits

Pro Tips & Best Practices

Use Iterative Multiplicative Cancellation to Prevent Arithmetic Overflow

Calculating combinations C(n, r) by evaluating huge factorials like n! directly causes numerical calculation limits to fail once n passes 170. Instead, take advantage of the mathematical symmetry C(n, r) = C(n, n - r) to keep your calculations small, and calculate progressively by multiplying and dividing term by term: C(n, r) = Product((n - r + i) / i) for i = 1 to r. Every intermediate division produces a clean whole number and keeps calculations fast and exact.

Differentiate Combinations from Permutations with the 'Role Test'

To determine instantly whether a real-world scenario is a permutation or a combination, apply the 'Role Test.' Give distinct titles to each position—such as President, Vice President, and Treasurer, or Gold, Silver, and Bronze medals. If swapping two people alters their titles or responsibilities, sequence matters: use Permutations P(n, r). If swapping people leaves the group unchanged (such as three equal co-captains or a committee), use Combinations C(n, r).

Leverage the Stars and Bars Method for Selections with Repetition

When choosing r items from n categories where items can be chosen multiple times (such as picking 8 scoops of gelato from 4 available flavours), picture placing 8 identical scoops ('stars') between 3 dividers ('bars') separating the flavour tubs. The formula C(n + r - 1, r) transforms what looks like a complicated multichoice puzzle into a standard combination problem without repetition: C(4 + 8 - 1, 8) = C(11, 8) = 165 delicious possibilities.

Harness Symmetry to Halve Calculation Effort: C(n, r) Equals C(n, n - r)

Choosing r items to invite to a gathering is mathematically identical to choosing the n - r items you leave out. Therefore, C(n, r) always equals C(n, n - r). For example, choosing 98 runners out of 100 qualifiers C(100, 98) is identical to choosing the 2 runners who sit out: C(100, 2) = (100 × 99) / (2 × 1) = 4,950. Always replace r with min(r, n - r) to simplify pencil-and-paper or automated calculations.

Distinguish Circular Seating from Fixed Linear Lines

When seating n guests around a round dining table, shifting every person one seat to the right leaves everyone with the exact same neighbours on their left and right. Fixing one guest's position breaks the rotational loop, giving (n - 1)! unique seating arrangements rather than n!. If arranging beads on a bracelet or charms on a keychain that can be flipped over, divide by 2: (n - 1)! / 2.

Common Gotchas & Troubleshooting

⚠️Calculator outputs Infinity or NaN when n exceeds 170

Standard everyday computing registers run out of capacity when factorials reach 171! (~1.24 × 10^309). Our calculator employs arbitrary-precision whole-number mathematics and extended-precision decimal arithmetic, allowing you to compute exact factorials, permutations, and combinations for values of n up to 10,000 without scientific notation breakdown or loss of precision.

⚠️The sample size r is greater than the total population n, producing an error or 0

In selections without repetition (where each item or individual can only be picked once), you cannot draw more items than the pool contains; therefore, P(n, r) = 0 and C(n, r) = 0 whenever r > n. If your real-world situation allows picking an item repeatedly (such as rolling a 6-sided die 10 times or creating a PIN code), enable the 'Allow Repetition' setting to calculate n^r or C(n + r - 1, r).

⚠️Calculated lottery odds do not match the published jackpot odds on the official ticket

Major lottery games (such as Powerball or Mega Millions) use two independent lottery drums rather than one combined draw. In US Powerball, you must match 5 white balls out of 69 AND 1 red ball out of 26. The true jackpot odds require multiplying both independent combinations: C(69, 5) × C(26, 1) = 11,238,513 × 26 = 292,201,338 to 1. Always multiply separate draws together when modeling multi-pool games.

⚠️Item list generator slows down or limits results when listing every combination

Combinatorial outcomes multiply factorially: arranging 5 items produces 120 lists, 10 items produces over 3.6 million lists, and 15 items exceeds 1.3 trillion possibilities, which would instantly overwhelm any device's screen. The generator displays up to 5,000 sample arrangements interactively for quick browsing while providing exact mathematical totals and export options for deeper study.

⚠️Word anagram count does not match the permutation formula nPr

When a word contains repeated letters (such as 'MOM' with two Ms or 'BANANA' with three As and two Ns), standard nPr treats each letter as distinct, resulting in counted duplicates that look identical. To find true unique anagrams, use the Multinomial formula n! / (n1! × n2! × ... × nk!), dividing out the duplicates for each repeated character to reveal only distinguishable words.

Frequently Asked Questions

What is the difference between permutation and combination?▼

The primary difference is that permutations care about the order of arrangement, whereas combinations care only about group membership regardless of order. In a permutation, sequence matters: winning gold, silver, and bronze (1, 2, 3) is completely different from (3, 2, 1). In a combination, order is irrelevant: a team of three friends {Alice, Bob, Charlie} is the exact same group as {Charlie, Alice, Bob}.

How do you calculate permutations and combinations step by step?▼

To calculate permutations without replacement, use P(n, r) = n! / (n - r)!, multiplying r descending numbers starting at n: for P(5, 3), calculate 5 × 4 × 3 = 60. To calculate combinations without replacement, use C(n, r) = n! / [r! × (n - r)!], which divides the permutation result by r! to remove duplicate group orderings: for C(5, 3), calculate (5 × 4 × 3) / (3 × 2 × 1) = 60 / 6 = 10.

What is the formula for combinations with repetition?▼

The formula for combinations with repetition is C_R(n, r) = C(n + r - 1, r) = (n + r - 1)! / [r! × (n - 1)!], frequently called the stars and bars method. It determines how many ways you can select r items from n categories when each category can be chosen multiple times, such as selecting 5 scoops of ice cream from 3 available flavours: C(3 + 5 - 1, 5) = C(7, 5) = 21 unique bowl combinations.

Why does 0 factorial (0!) equal 1?▼

In combinatorics, 0! equals 1 because there is exactly one way to arrange zero objects: the empty arrangement. Mathematically, the recursive definition of factorials states that (n - 1)! = n! / n; plugging in n = 1 yields 0! = 1! / 1 = 1. Defining 0! = 1 also prevents formulas like P(n, n) = n! / (n - n)! = n! / 0! from failing with division by zero.

How do you calculate lottery jackpot odds using combinations?▼

Lottery odds are calculated using combinations without replacement C(n, r), where n is the total number of numbered balls in the bin and r is the number of winning numbers drawn. In a classic 6/49 lottery, the total number of unique ticket combinations is C(49, 6) = 49! / [6! × 43!] = 13,983,816. If you buy one ticket, your probability of hitting the jackpot is exactly 1 in 13,983,816 (~0.00000715%).

How do combinations apply to password security and cracking time?▼

Password complexity relies on permutations with repetition, calculated as Total Possibilities = N^L, where N is the character pool size and L is password length. An 8-character password using only lowercase letters offers 26^8 ≈ 208 billion combinations (cracked in seconds), while combining uppercase letters, lowercase letters, numbers, and symbols (94 options) yields 94^8 ≈ 6.1 × 10^15 combinations, increasing cracking time to months or years under equivalent hardware guessing rates.

Related Tools & Utilities

All Tools →