Permutation & Combination Calculator — Exact nPr & nCr Solver

Free permutation and combination calculator to compute nPr, nCr, permutations with repetition, circular arrangements, and combinations with replacement using exact BigInt precision.

🔒 100% Private
⚡ Completely Free
🌐 Runs in Browser
📦 Export Ready
⚡

Permutation & Combination Calculator — Exact nPr & nCr Solver

Tool Workspace

Ready

Loading tool...

  1. Define Sample Space ($n$) — Enter the total pool of available items or distinct elements ($n \ge 0$).
  2. Specify Selection Subset ($r$) — Enter the number of items to select, arrange, or sample ($0 \le r \le n$ for non-replacement modes).
  3. Choose Combinatorial Paradigm — Inspect simultaneously evaluated metrics: Permutations without Repetition $P(n,r)$, Combinations without Repetition $C(n,r)$, Permutations with Repetition ($n^r$), Combinations with Repetition, and Circular Permutations.
  4. Copy High-Precision Solutions — Transfer exact integer outputs, mathematical factorials, or step-by-step algebraic quotient cancellations directly to your clipboard for statistics, computer science, or gaming probability analysis.

Advanced Permutation and Combination Combinatorial Engine

In discrete mathematics, statistical mechanics, cryptography, algorithmic complexity analysis, and computational probability, combinatorics provides the quantitative framework for enumerating, arranging, and selecting subsets of finite sets. The Permutation & Combination Calculator delivers an enterprise-grade computational platform designed to evaluate linear arrangements, unordered selections, replacement variants, and circular permutations with uncompromising exactitude.

Powered by native JavaScript BigInt arbitrary-precision arithmetic, this tool overcomes the severe limitations of standard 64-bit IEEE 754 floating-point calculators that overflow past $170!$. Whether modeling cryptographic password space entropy, designing genomic codon permutations, calculating high-stakes lottery odds, or optimizing discrete scheduling queues, our calculator provides exact integer outputs accompanied by step-by-step factorial algebraic cancellations and zero remote server dependence.

Mathematical Formulations: Arrangements versus Selections

The core distinction in combinatorial enumeration hinges upon whether the spatial or temporal sequence of chosen elements confers uniqueness:

1. Linear Permutations Without Repetition: $P(n,r)$ or $_nP_r$

When selecting $r$ distinct items from a total pool of $n$ available items where sequence order matters and items cannot be reused, the total permutations are defined by the falling factorial:

$$\mathbf{P(n,r) = \frac{n!}{(n - r)!} = n \times (n - 1) \times (n - 2) \times \dots \times (n - r + 1)}$$

Example: Arranging 3 medals (Gold, Silver, Bronze) among 10 track competitors: $P(10,3) = \frac{10!}{(10-3)!} = 10 \times 9 \times 8 = 720$ distinct podium permutations.

2. Combinations Without Repetition: $C(n,r)$ or $\binom{n}{r}$

When group membership alone matters and internal ordering is irrelevant, each subset of $r$ elements can be arranged in $r!$ equivalent ways. Dividing $P(n,r)$ by $r!$ eliminates order-induced duplication, yielding the binomial coefficient:

$$\mathbf{C(n,r) = \binom{n}{r} = \frac{n!}{r! \times (n - r)!}}$$

Example: Selecting a 5-person executive steering committee from 20 eligible board directors: $C(20,5) = \frac{20!}{5! \times 15!} = \frac{20 \times 19 \times 18 \times 17 \times 16}{120} = 15,504$ unique committees.

3. Permutations With Repetition: $n^r$

When order matters and each of the $r$ slots can independently select from all $n$ candidates (sampling with replacement), the fundamental counting principle yields:

$$\mathbf{P_{\text{rep}}(n,r) = n^r}$$

Example: An 8-character alphanumeric PIN using lowercase letters (26 choices) allows $26^8 = 208,827,064,576$ distinct passcode permutations.

4. Combinations With Repetition (Multisets): $C(n + r - 1, r)$

Often visualized via the classic mathematical method of Stars and Bars, choosing $r$ elements from $n$ types where elements can be chosen multiple times without regard to order equals:

$$\mathbf{C_{\text{rep}}(n,r) = \binom{n + r - 1}{r} = \frac{(n + r - 1)!}{r! \times (n - 1)!}}$$

Example: Purchasing a dozen (12) donuts from a shop offering 4 distinct flavors: $C(4 + 12 - 1, 12) = C(15, 12) = \frac{15!}{12! \times 3!} = \frac{15 \times 14 \times 13}{6} = 455$ flavor assortments.

5. Circular Permutations

When elements are arranged in a closed loop or round circle without a fixed landmark or anchor position, rotating the entire circle does not produce a distinct permutation. Fixing one reference element reduces the degree of freedom by 1:

$$\mathbf{P_{\text{circle}}(n) = (n - 1)!}$$

If physical reflections are indistinguishable (such as keys on a key ring or beads on a necklace that can be flipped over), the count is halved: $\frac{(n - 1)!}{2}$.

Comparative Architectural Matrix: Combinatorial Sampling Paradigms

The four primary combinatorial sampling paradigms form a complete four-quadrant matrix based on order sensitivity and element replacement:

Combinatorial Model Order Sensitive? Replacement Allowed? Standard Governing Formula Archetypal Real-World Application
Permutations without Replacement Yes (Order Matters) No (Unique Items) $P(n,r) = \frac{n!}{(n-r)!}$ Podium finishes, password sequences, DNA codon orderings.
Permutations with Replacement Yes (Order Matters) Yes (Reusable Items) $P_{\text{rep}} = n^r$ Luggage combination locks, brute-force key spaces, IP addressing.
Combinations without Replacement No (Order Irrelevant) No (Unique Items) $C(n,r) = \frac{n!}{r!(n-r)!}$ Lottery ticket drawings, poker hands, committee selection.
Combinations with Replacement No (Order Irrelevant) Yes (Reusable Items) $C_{\text{rep}} = \binom{n+r-1}{r}$ Bakery flavor assortments, coin change problems, boson quantum states.

Engineering Specifications and High-Precision BigInt Standards

Standard floating-point computing environments encounter catastrophic truncation when evaluating combinatorial factorials. This utility implements strict precision safeguards:

Computational Property Implementation Standard Architectural Capability & Boundary Behavior
Integer Precision Engine Arbitrary-Precision BigInt Prevents floating-point mantissa clipping; handles integers with thousands of digits.
Input Bounds Validation $n \ge 0$, $r \ge 0$ (Integers) Automatically rejects non-integers, negative quantities, or invalid $r > n$ bounds.
Factorial Quotient Cancellation Surgical BigInt Division Computes $\frac{n!}{(n-r)!}$ by direct product reduction to avoid intermediate memory spikes.
Symmetry Optimization $C(n,r) = C(n, n-r)$ Replaces $r$ with $\min(r, n-r)$ to minimize computation loop cycles.
Client Execution Safety 100% In-Browser Isolation Guarantees zero transmission of statistical models, datasets, or inputs to external networks.

Step-by-Step Practical Calculation Examples

Example 1: State Lottery Odds Calculation (6/49 Format)

A national lottery requires players to select 6 distinct numbers from a pool of 49 integers. To determine the exact odds of winning the jackpot:

  1. Identify parameters: Total pool $n = 49$, winning subset size $r = 6$.
  2. Since balls are drawn without replacement and order does not matter, apply $C(n,r)$: $$C(49,6) = \frac{49!}{6! \times (49 - 6)!} = \frac{49!}{6! \times 43!}$$
  3. Cancel out $43!$ from numerator and denominator: $$C(49,6) = \frac{49 \times 48 \times 47 \times 46 \times 45 \times 44}{6 \times 5 \times 4 \times 3 \times 2 \times 1}$$
  4. Evaluate numerator: $49 \times 48 \times 47 \times 46 \times 45 \times 44 = 10,068,347,520$.
  5. Evaluate denominator: $6! = 720$.
  6. Divide exact integers: $\frac{10,068,347,520}{720} = 13,983,816$.
  7. Result: There are exactly $13,983,816$ possible tickets. The probability of winning with a single ticket is $\frac{1}{13,983,816} \approx 0.00000007151$ ($0.00000715\%$).

Example 2: Poker Hand Combinatorics (Royal Flush Probability)

In standard 5-card poker dealt from a 52-card deck:

  1. Total 5-card hands: $C(52,5) = \frac{52!}{5! \times 47!} = \frac{52 \times 51 \times 50 \times 49 \times 48}{120} = 2,598,960$ unique hands.
  2. A Royal Flush consists of A, K, Q, J, 10 in the same suit. Since there are 4 suits (Spades, Hearts, Diamonds, Clubs), there are exactly 4 royal flushes.
  3. Exact probability: $\frac{4}{2,598,960} = \frac{1}{649,740} \approx 0.000001539$.

Example 3: Password Space Entropy and Key Strength

An authentication system requires an 8-character password chosen from 26 uppercase letters, 26 lowercase letters, and 10 digits (total character set $n = 62$).

  1. Since characters can repeat and ordering matters, apply $P_{\text{rep}} = n^r = 62^8$.
  2. Compute exact BigInt value: $62^8 = 218,340,105,584,896$ possible passwords.
  3. Convert to binary entropy: $\log_2(62^8) = 8 \times \log_2(62) \approx 8 \times 5.9542 \approx 47.63\,\text{bits}$ of cryptographic entropy.

Algebraic Identities and Binomial Theorem Connections

Combinations form the algebraic foundation of Sir Isaac Newton's generalized Binomial Theorem. When expanding any polynomial binomial of the form $(x + y)^n$, each expansion coefficient corresponds precisely to an un-ordered combination $C(n,k)$:

$$\mathbf{(x + y)^n = \sum_{k=0}^{n} \binom{n}{k} x^{n-k} y^k}$$

Setting $x = 1$ and $y = 1$ in this identity produces the celebrated power-set summation property: $\sum_{k=0}^{n} \binom{n}{k} = 2^n$, proving that a set with $n$ elements possesses exactly $2^n$ distinct subsets.

Multiset Permutations with Indistinguishable Elements

When arranging an ordered string of $N$ total elements containing subsets of identical, indistinguishable items of multiplicities $k_1, k_2, \dots, k_m$ where $\sum k_i = N$, naive $N!$ factorial counts over-represent equivalent arrangements. The true unique permutations are evaluated via the multinomial coefficient:

$$\mathbf{P_{\text{multiset}} = \frac{N!}{k_1! \times k_2! \times \dots \times k_m!}}$$

This formulation is critical in bioinformatics for counting distinct genomic RNA codon sequences and in computational linguistics for calculating anagram permutations.

Derangements and Subfactorials ($!n$)

A derangement is a permutation of $n$ elements such that no single element appears in its original starting position (a complete fixed-point-free permutation). Expressed as the subfactorial $!n$, the closed-form recurrence is given by:

$$\mathbf{!n = (n - 1) \times (!(n - 1) + !(n - 2)) = n! \sum_{k=0}^{n} \frac{(-1)^k}{k!}}$$

As $n \to \infty$, the proportion of all permutations that are derangements rapidly converges to $\frac{1}{e} \approx 36.788\%$, solving the classical 'hat check' problem in applied probability.

Contextual Tools and Mathematical Solvers

Expand your mathematical investigations with our synchronized suite of online calculation tools:

  • Compute deep integer factorials, double factorials, and gamma approximations with our Factorial Calculator.
  • Model statistical distributions, independent event chances, and dice outcomes using the Probability Calculator.
  • Evaluate exponential powers, powers of two, and modular power equations via the Exponent Calculator.
  • Simplify exact combinatorial ratios, odds fractions, and rational probabilities using our Fraction Calculator.

Frequently Encountered Pitfalls in Combinatorial Analysis

Avoid classic analytical traps when formulating permutation and combination problems:

  • Confusing Everyday Language with Mathematical Definitions: Everyday speech uses 'combination lock', but a combination lock strictly requires an ordered sequence (e.g., 24-12-38 is completely different from 12-24-38), making it mathematically a permutation lock.
  • Forgetting to Account for Indistinguishable Elements: Arranging the letters in 'MISSISSIPPI' (11 letters: 1 M, 4 I, 4 S, 2 P) is not $11!$. One must divide by the factorials of repeated items: $\frac{11!}{1! \times 4! \times 4! \times 2!} = 34,650$ distinct anagrams.
  • Assuming Order Doesn't Matter When Assigning Specific Roles: Selecting 3 people to clean a room is a combination $C(n,3)$. But selecting 3 people where one sweeps, one mops, and one washes windows is a permutation $P(n,3)$ because the designated roles introduce sequence uniqueness.
  • Ignoring Floating-Point Overflow in Naive Implementations: Computing $n!$ first and then dividing by $(n-r)!$ in standard 64-bit floats overflows for $n > 170$. Our engine performs direct numerator-denominator cancellation using BigInt to prevent arithmetic overflows.

Client-Side Security and In-Browser Performance Guarantees

All combinatorial algorithms, factorial multiplications, BigInt quotient cancellations, and formatted outputs execute 100% locally within your client browser engine. No statistical numbers, algorithmic parameters, or password security evaluations are ever transmitted across external networks or stored on remote servers. Enjoy instantaneous calculation performance, absolute mathematical accuracy, and total privacy on every device.

Frequently Asked Questions

What is the fundamental difference between a permutation and a combination?

The critical differentiator is sequence ordering. In permutations, the order of arrangement matters: the sequence (A, B, C) is treated as completely distinct from (C, B, A). In combinations, order is irrelevant and only group membership matters: {A, B, C} and {C, B, A} represent the exact same single combination. Consequently, for any selection of size r > 1 from n items, the number of permutations P(n,r) is always strictly greater than combinations C(n,r) by a factor of r!.

What are the core mathematical formulas for nPr and nCr?

Permutations without repetition are calculated as: P(n,r) = n! / (n - r)!. Combinations without repetition divide out the internal r! order permutations: C(n,r) = n! / (r! × (n - r)!). For permutations with repetition allowed across r positions, the total count is n^r. For combinations with repetition (multisets), the formula is C(n + r - 1, r) = (n + r - 1)! / (r! × (n - 1)!).

How large of a number can this calculator process without precision loss?

Unlike conventional web calculators that overflow to 'Infinity' or degrade to approximate scientific floating-point notation around n = 170, our engine uses native arbitrary-precision BigInt arithmetic. This enables exact integer computation for astronomically large factorials and combinatorial spaces without rounding errors or dropped digits.

What is the combinatorial significance of zero factorial (0! = 1)?

In combinatorial set theory, 0! represents the number of ways to arrange an empty set of zero objects. There is exactly one unique way to arrange nothing: the empty arrangement. Mathematically, setting 0! = 1 preserves algebraic consistency across recursive factorial definitions n! = n × (n - 1)! and ensures that selecting all n items from n (C(n,n) = n! / (n! × 0!)) evaluates correctly to 1.

How does circular permutation differ from linear permutation?

In linear permutations of n distinct items, there are n! arrangements because start and end positions are distinct. In circular arrangements (such as guests seated around an unnumbered round dining table), rotations do not create new arrangements. Fixing one reference item eliminates rotational redundancy, yielding (n - 1)! distinct circular permutations. If reflectional symmetry applies (like beads on a necklace viewed from both sides), the count is (n - 1)! / 2.

What is the relationship between combinations and Pascal's Triangle?

The numbers in Pascal's Triangle correspond exactly to binomial coefficients: the entry at row n and column r equals C(n,r) = (n choose r). This structure illustrates Pascal's identity: C(n, r) = C(n - 1, r - 1) + C(n - 1, r), which forms the algorithmic foundation for dynamic programming solutions in combinatorics and probability distribution modeling.

How are combinations used in lottery odds and poker hand probabilities?

In a standard 6/49 lottery, drawing 6 winning balls from 49 candidates without replacement requires calculating C(49, 6) = 49! / (6! × 43!) = 13,983,816 possible tickets, making the probability of matching all 6 numbers exactly 1 in 13,983,816. In poker, the total number of 5-card hands drawn from a standard 52-card deck equals C(52, 5) = 2,598,960 unique five-card combinations.

Are my combinatorial inputs or cryptographic keys sent to external servers?

No. All combinatorial algorithms, factorial multiplications, BigInt quotient cancellations, and formatted outputs execute 100% locally within your client browser engine. Your numbers, statistical models, password entropy audits, and combinatorial research remain completely private on your local machine.