Skip to content
UniKit

Combination & permutation calculator

Exact combinations C(n,k) and permutations P(n,r) with BigInt results, a log-based approximation for huge inputs, Pascal’s triangle, binomial expansion coefficients, combinations with repetition and multinomial coefficients.

Runs in your browserEvery computation happens in your browser — your data never leaves this device.

Combinations C(n, k)120
Digits in C(n, k)3
ln C(n, k) (log approximation)4.787492
Permutations P(n, k)720
Combinations with repetition C(n + k − 1, k)220
Multinomial coefficient30
Pascal’s triangle (first n rows)
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
1 9 36 84 126 126 84 36 9 1
Binomial expansion (a + b)^n
a^10 + 10a^9b + 45a^8b^2 + 120a^7b^3 + 210a^6b^4 + 252a^5b^5 + 210a^4b^6 + 120a^3b^7 + 45a^2b^8 + 10ab^9 + b^10

What this tool does

  • Work out lottery or raffle odds: even large coefficients such as C(52,5) come back as an exact integer instead of a floating point approximation.
  • Do statistics homework faster — C(n,k), P(n,k), combinations with repetition and multinomial coefficients in one place.
  • Check a binomial expansion: the coefficients of (a + b)^n are listed term by term, matching Pascal’s triangle.
  • Estimate enormous coefficients: once n reaches the tens of thousands the exact integer is useless, but the logarithm and the digit count still tell you the magnitude.

Example

Input

n = 10, k = 3, groups 2,2,1

Output

C(10, 3) = 120, P(10, 3) = 720, with repetition C(12, 3) = 220, ln C(10, 3) ≈ 4.787492, digits 3, multinomial 5!/(2!·2!·1!) = 30

Pascal’s triangle is drawn with n rows (at most 20) and the binomial expansion is shown for n ≤ 20.

Frequently asked questions

What is the difference between C(n, k) and P(n, k)?

Combinations ignore the order, permutations keep it. P(n, k) = C(n, k) × k!, so choosing 3 people out of 10 gives C(10,3)=120, while lining them up gives P(10,3)=720.

Is the result still accurate for large n?

Up to n = 2000 you get a digit-exact BigInt you can copy. Beyond that the coefficient has thousands of digits, so the tool reports ln C(n,k) and the number of decimal digits instead — those figures stay accurate, but no full integer is produced.

What happens when k is larger than n?

Following the usual combinatorial convention the result is 0 rather than an error, because you cannot choose k items out of n. The logarithmic form shows −∞.

When do I need combinations with repetition or multinomial coefficients?

Combinations with repetition C(n+k−1, k) apply when picking is allowed to repeat, for example 2 scoops from 3 flavours (6 ways). Multinomial coefficients count the ways to split a set into labelled groups, e.g. 30 ways to split 5 people into groups of 2, 2 and 1.

Why does Pascal’s triangle match the combinations?

Because C(n, k) = C(n−1, k−1) + C(n−1, k) is exactly the triangle rule: every entry is the sum of the two above it. The unit tests compare both algorithms entry by entry.

Keywords:combinationpermutationnCrnPrbinomial coefficientpascal trianglemultinomial组合数排列数杨辉三角二项式展开多项式系数可重复组合

Related tools