Combinatorics Calculator
Calculate permutations, combinations, factorials, circular arrangements, and more instantly online. Includes formulas, step-by-step explanations, and educational breakdowns.
Combinatorics Calculator
Calculate permutations, combinations, factorials, circular arrangements, and multiset permutations instantly. Step-by-step formulas included. All calculations run locally in your browser using exact BigInt arithmetic.
Example Presets
Operation
Unordered selections — order does not matter
Values
Non-negative integer · max 1000
Must satisfy r ≤ n
Ctrl+Enter to recalculate
Select an operation and enter values to calculate.
Try one of the example presets to get started.
What Is Combinatorics?
Combinatorics is the branch of mathematics that studies counting, arrangement, and selection of objects. It underpins probability theory, algorithm analysis, cryptography, statistics, and competitive programming. The two most fundamental operations are permutations (ordered arrangements) and combinations (unordered selections).
This calculator uses exact BigInt arithmetic — no floating-point rounding — so results for factorials and combinations are always precise regardless of size.
Core Formulas
Factorial n! = n × (n−1) × … × 2 × 1 0! = 1 Permutation (nPr) n! ÷ (n−r)! 5P2 = 5! ÷ 3! = 120 ÷ 6 = 20 Combination (nCr) n! ÷ (r! × (n−r)!) 10C3 = 10! ÷ (3! × 7!) = 3628800 ÷ 30240 = 120 Perm w/ Repetition nʳ 3^4 = 81 Comb w/ Repetition (n+r−1)! ÷ (r! × (n−1)!) C(5+3−1, 3) = C(7, 3) = 35 Circular Permutation (n−1)! 6 people round a table: (6−1)! = 120 Multiset Permutation n! ÷ (a! × b! × c! × …) MISSISSIPPI (11 letters): 11! ÷ (4! × 4! × 2! × 1!) = 34650
Permutation vs Combination
| Property | Permutation | Combination |
|---|---|---|
| Order matters? | Yes | No |
| Formula | n! ÷ (n−r)! | n! ÷ (r!(n−r)!) |
| ABC ≠ BAC? | Yes | No (same) |
| Example | PIN codes, races | Lottery, committees |
| Notation | nPr or P(n,r) | nCr, C(n,r), or ⁿCᵣ |
| Always ≥ nCr? | Yes (by r! factor) | Base case |
Real-World Applications
Lottery probability
A 6-from-49 lottery requires choosing 6 numbers from 49 without order. The number of possible tickets is C(49, 6) = 13,983,816. Your probability of winning = 1 / 13,983,816.
Password security
A 4-digit PIN using digits 0–9 with repetition allowed has 10^4 = 10,000 possibilities. A 4-character password from 62 alphanumeric characters has 62^4 = 14,776,336 combinations.
Algorithm analysis
Combinatorics is central to Big-O analysis. Sorting n elements requires at least log₂(n!) comparisons — this is where Ω(n log n) lower bound for comparison-based sorting comes from.
Machine learning
Hyperparameter grid search explores combinations of settings. For 5 parameters each with 4 options, a full grid has 4^5 = 1,024 configurations — combinatorics explains why random search is often preferred.
Circular seating problems
Arranging n people around a circular table: (n−1)! because one person is fixed as a reference point, eliminating rotationally identical arrangements.
Pascal's Triangle and Binomial Coefficients
Combinations nCr are the entries of Pascal's Triangle. Each entry equals the sum of the two entries directly above it. Row n contains C(n,0) through C(n,n). This relationship underlies the Binomial Theorem: (a+b)^n = Σ C(n,k) × a^(n−k) × b^k.
n=0: 1 n=1: 1 1 n=2: 1 2 1 n=3: 1 3 3 1 n=4: 1 4 6 4 1 n=5: 1 5 10 10 5 1
Frequently Asked Questions
Why is 0! = 1?
By convention and mathematical consistency. The number of ways to arrange zero objects is exactly one — the empty arrangement. This also makes the permutation and combination formulas work correctly at edge cases like C(n, 0) = 1.
What is the difference between permutation with and without repetition?
Without repetition (standard nPr): once an item is selected it cannot be selected again. With repetition: each selection is independent and any item can appear multiple times. Example — a 4-digit PIN from digits 0–9 with repetition = 10^4 = 10,000. Without repetition = P(10,4) = 5,040.
When do I use combination with repetition?
Use it when selecting from a set of types where you can pick the same type multiple times and order doesn't matter. Classic example: choosing 3 ice cream scoops from 5 flavors (you can repeat flavors). Answer: C(5+3−1, 3) = C(7,3) = 35.
How large can n be before results become unreliable?
This calculator uses JavaScript BigInt for exact integer arithmetic, so results are mathematically precise for any n up to 1000. Beyond that, numbers have hundreds or thousands of digits and are displayed in scientific notation.
What is a multiset permutation?
A multiset permutation counts arrangements of a collection where some objects are identical. For example, the word MISSISSIPPI has 11 letters with repetitions: M×1, I×4, S×4, P×2. Distinct arrangements = 11! ÷ (1! × 4! × 4! × 2!) = 34,650.
What is the relationship between nCr and nPr?
nPr = nCr × r! — a permutation is a combination with the r selected items then arranged in all possible orders. Equivalently, nCr = nPr ÷ r!, dividing by r! removes the order.
Related Tools
Model Accuracy Calculator
Calculate machine learning model accuracy instantly. Compare actual vs predicted labels, evaluate AI performance, upload CSV data, and get instant results online for free.
Dataset Split Calculator
Calculate train, validation, and test dataset splits instantly online. Split datasets for machine learning using custom ratios or percentages with real-time visualization.
F1 Score Calculator
Calculate F1 score instantly using confusion matrix or precision and recall values. Free online F1 score calculator for AI, machine learning, classification, and data science.
Time Complexity Calculator
Estimate algorithm time complexity using Big-O notation. Analyze loop patterns, recursion, and algorithm presets with interactive growth visualizations and educational explanations.
Percentage Calculator
Calculate percent of a number, percentage increase/decrease, reverse percentage, and multi-step percentage changes instantly.