Home › Math › Combinations and Permutations Calculator
Combinations and Permutations Calculator
Counts the ways to choose k items from n: combinations C(n, k) when order does not matter and permutations P(n, k) when it does, with or without repetition.
When to use
You need nCr (binomial coefficient), nPr, or the number of multisets or sequences of length k drawn from n items.
Do not use when: You need the probability of a specific outcome (use probability-of-events or binomial-distribution) or a plain factorial (use factorial).
Formula
Without repetition: C(n,k) = n! / (k! (n−k)!), P(n,k) = n! / (n−k)!. With repetition: C = (n+k−1)! / (k! (n−1)!), P = n^k
Computed with the multiplicative formula (no intermediate factorials) so that n can be large; results above 2^53 are correct to about 15 significant digits.
Inputs
| Parameter | Type | Unit | Required | Description |
|---|---|---|---|---|
n | integer | yes | Size of the set. Range: ≥ 0, ≤ 100000 | |
k | integer | yes | Number of items selected or arranged. Range: ≥ 0, ≤ 1000 | |
with_repetition | boolean | default false | true when an item may be chosen more than once (multisets / sequences with replacement). |
Outputs
| Output | Type | Unit | Description |
|---|---|---|---|
combinations | number | C(n, k) = n! / (k!(n − k)!), or C(n + k − 1, k) with repetition. | |
permutations | number | P(n, k) = n! / (n − k)!, or n^k with repetition. | |
expression | string | The formulas with the numbers filled in. |
Example
Choose 3 of 10: {"n":10,"k":3,"with_repetition":false} → {"combinations":120,"permutations":720,"expression":"C(10,3) = 120; P(10,3) = 720"}
Choose 2 of 5 with repetition: {"n":5,"k":2,"with_repetition":true} → {"combinations":15,"permutations":25}
GET https://tttkmbb.com/api/v1/calculate/combinations-permutations?n=10&k=3&with_repetition=false
Machine access
- API:
GET https://tttkmbb.com/api/v1/calculate/combinations-permutations(query parameters) orPOSTwith a JSON body{"inputs": {...}} - Schema: https://tttkmbb.com/api/v1/calculators/combinations-permutations · Markdown: https://tttkmbb.com/math/combinations-permutations.md · JSON definition: https://tttkmbb.com/math/combinations-permutations.json
- MCP: server
https://tttkmbb.com/mcp, toolrun_calculator with calculator_id="combinations-permutations" - OpenAPI operationId:
calculate_combinations_permutations - Freshness:
static. Authentication: none. Rate limit: fair use (see rate limits).
Sources
- Wikipedia – Combination (reference)
- Wikipedia – Permutation (reference)
- NIST Digital Library of Mathematical Functions §26.3 – Lattice paths: binomial coefficients (standard)
FAQ
Combination or permutation?
Use combinations when only which items are chosen matters (lottery numbers, committees) and permutations when their order matters (rankings, passwords).
What happens when k > n without repetition?
There are no such selections, so both counts are 0.
Related calculators
- Factorial Calculator — The factorials behind these formulas.
- Binomial Distribution Calculator — Probabilities of k successes in n trials use C(n, k).
- Probability of Two Events Calculator — Turn counts of outcomes into probabilities.