{"success":true,"version":"v1","request":{"tool":"get_calculator_schema","calculator_id":"combinations-permutations"},"result":{"entity_type":"calculator","id":"combinations-permutations","calculator_id":"combinations-permutations","canonical_url":"https://tttkmbb.com/math/combinations-permutations","name":"Combinations and Permutations Calculator","title":"Combinations and Permutations Calculator – nCr and nPr With or Without Repetition","category":"math","category_name":"Math","tool_name":"calculate_combinations_permutations","featured_mcp_tool":false,"description":"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.","use_when":"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).","inputs":[{"name":"n","label":"n (items to choose from)","type":"integer","required":true,"min":0,"max":100000,"description":"Size of the set.","example":10},{"name":"k","label":"k (items chosen)","type":"integer","required":true,"min":0,"max":1000,"description":"Number of items selected or arranged.","example":3},{"name":"with_repetition","label":"Allow repetition","type":"boolean","required":false,"default":false,"description":"true when an item may be chosen more than once (multisets / sequences with replacement).","example":false}],"outputs":[{"name":"combinations","label":"Combinations (order does not matter)","type":"number","decimals":0,"description":"C(n, k) = n! / (k!(n − k)!), or C(n + k − 1, k) with repetition."},{"name":"permutations","label":"Permutations (order matters)","type":"number","decimals":0,"description":"P(n, k) = n! / (n − k)!, or n^k with repetition."},{"name":"expression","label":"Expression","type":"string","decimals":4,"description":"The formulas with the numbers filled in."}],"input_schema":{"type":"object","properties":{"n":{"description":"Size of the set.","type":"integer","minimum":0,"maximum":100000,"examples":[10]},"k":{"description":"Number of items selected or arranged.","type":"integer","minimum":0,"maximum":1000,"examples":[3]},"with_repetition":{"description":"true when an item may be chosen more than once (multisets / sequences with replacement).","type":"boolean","default":false,"examples":[false]}},"additionalProperties":false,"required":["n","k"]},"output_schema":{"type":"object","properties":{"combinations":{"description":"C(n, k) = n! / (k!(n − k)!), or C(n + k − 1, k) with repetition.","type":"number"},"permutations":{"description":"P(n, k) = n! / (n − k)!, or n^k with repetition.","type":"number"},"expression":{"description":"The formulas with the numbers filled in.","type":"string"}}},"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","method":"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.","sources":[{"name":"Wikipedia – Combination","url":"https://en.wikipedia.org/wiki/Combination","type":"reference","retrieved_at":"2026-09-23"},{"name":"Wikipedia – Permutation","url":"https://en.wikipedia.org/wiki/Permutation","type":"reference","retrieved_at":"2026-09-23"},{"name":"NIST Digital Library of Mathematical Functions §26.3 – Lattice paths: binomial coefficients","url":"https://dlmf.nist.gov/26.3","type":"standard","retrieved_at":"2026-09-23"}],"freshness":{"type":"static","max_age_seconds":null,"note":"Deterministic formula with fixed constants; results never go stale. Inputs supplied by the caller determine the output."},"examples":[{"name":"Choose 3 of 10","inputs":{"n":10,"k":3,"with_repetition":false},"expected":{"combinations":120,"permutations":720,"expression":"C(10,3) = 120; P(10,3) = 720"},"url":"https://tttkmbb.com/api/v1/calculate/combinations-permutations?n=10&k=3&with_repetition=false"},{"name":"Choose 2 of 5 with repetition","inputs":{"n":5,"k":2,"with_repetition":true},"expected":{"combinations":15,"permutations":25},"url":"https://tttkmbb.com/api/v1/calculate/combinations-permutations?n=5&k=2&with_repetition=true"}],"faq":[{"q":"Combination or permutation?","a":"Use combinations when only which items are chosen matters (lottery numbers, committees) and permutations when their order matters (rankings, passwords)."},{"q":"What happens when k > n without repetition?","a":"There are no such selections, so both counts are 0."}],"tags":["combinations","permutations","ncr","npr","binomial coefficient","choose"],"related":[{"calculator_id":"factorial","reason":"The factorials behind these formulas."},{"calculator_id":"binomial-distribution","reason":"Probabilities of k successes in n trials use C(n, k)."},{"calculator_id":"probability-of-events","reason":"Turn counts of outcomes into probabilities."}],"links":{"html":"https://tttkmbb.com/math/combinations-permutations","markdown":"https://tttkmbb.com/math/combinations-permutations.md","json":"https://tttkmbb.com/math/combinations-permutations.json","api":"https://tttkmbb.com/api/v1/calculate/combinations-permutations","schema":"https://tttkmbb.com/api/v1/calculators/combinations-permutations","openapi":"https://tttkmbb.com/openapi.json","mcp":"https://tttkmbb.com/mcp"},"version":"v1","updated_at":"2026-09-23"},"timestamp":"2026-09-23T23:23:06Z"}