Skip to content
Allin

Combinatorics

Permutations, combinations and arrangements — with and without repetition, and the count that follows. 8 tools, including Combination calculator (nCr), Derangement (subfactorial) calculator !n, Factorial calculator and Inclusion–exclusion principle calculator. All free, with no account and nothing to install.

Combination calculator (nCr)Compute the number of combinations nCr of r items from n.Derangement (subfactorial) calculator !nCompute the subfactorial !n — the number of derangements, permutations of n items in which nothing stays in its original place. It uses the exact recurrence !n = (n−1)·(!(n−1) + !(n−2)) with big integers, and shows the ratio !n / n!, which converges astonishingly fast to 1/e ≈ 0.3679. That ratio is the probability that a random shuffle leaves no element fixed — the classic 'hat-check' problem.Factorial calculatorCompute the factorial n! of a whole number.Inclusion–exclusion principle calculatorCompute the size of a union of 2 to 5 sets by inclusion–exclusion: add the individual sizes, subtract the pairwise overlaps, add back the triple overlaps, and so on, alternating signs. Work directly from your element lists — the tool sorts every element into its region and cross-checks the count — or from raw cardinalities like |A|, |A∩B|, |A∩B∩C| when you only know the counts. It shows each level's contribution and the final |A ∪ B ∪ …|.Permutation calculator (nPr)Compute the number of permutations nPr of r items from n.Permutations with repetition calculatorCount the ordered arrangements of length r drawn from n items when repetition is allowed — every position can be any of the n choices independently, giving exactly nʳ. This is the arrangement count for PIN codes, passwords, DNA strings and dice rolls, and it differs from ordinary permutations nPr, which forbid reuse. The result is computed exactly with big integers, however large it grows.Pigeonhole principle calculatorApply the pigeonhole principle: if N items go into M containers, at least one container must hold ⌈N/M⌉ items — no distribution can keep every container below that. Enter the items and containers to get that guaranteed minimum, and set a target k to find how many items you must place to force some container to reach k, namely M·(k−1)+1. A simple idea with surprisingly deep consequences across combinatorics and computer science.Stirling Numbers CalculatorStirling numbers of the first (signed & unsigned) and second kind, S(n,k), by exact recurrence.

Maths calculators