Integer permutations count
integer-permutations-count · version 1.0.0 · Numbers & math · free, no key needed
Compute the exact number of k-permutations of n distinct items, P(n, k) = n! / (n-k)!.
Use when you need to: integer permutations count · n permute k · arrangements count.
Supported
- integer permutations count
- n permute k
- arrangements count
Not supported
- binomial coefficient
- permutations with repetition
- negative n or k
Behavior
- n and k are JSON integers with 0 <= k <= n <= 100000.
- The result is P(n, k) = n * (n-1) * ... * (n-k+1), computed exactly with an incremental BigInt product (never materializing n! itself), never floating point.
- P(n, 0) is 1 for every valid n; P(n, n) equals n!.
- Requests whose exact result would exceed 1000 digits are rejected rather than truncated.
Input
n(integer, required): min 0; max 100000k(integer, required): min 0; max 100000
Output
value(string, required)
Limits
- max n: 100000
- max digits: 1000
Example
Request input:
{
"n": 5,
"k": 2
}
Response:
{
"result": {
"value": "20"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "integer-permutations-count",
"version": "1.0.0",
"input": {
"n": 5,
"k": 2
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/integer-permutations-count/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"n":5,"k":2}'
The machine-readable contract is at /v1/tools/integer-permutations-count/versions/1.0.0.
CLI
node cli.mjs run integer-permutations-count 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Integer binomial coefficient: Compute the exact binomial coefficient C(n, k), the number of ways to choose k items from n.
- Integer derangements count: Compute !n, the number of derangements (permutations with no fixed point) of n items, exactly.
- Array integer GCD: Compute the non-negative greatest common divisor of an array of canonical integer strings.
- Array integer LCM: Compute the non-negative least common multiple of an array of canonical integer strings.
- Integer factorial: Compute n! (n factorial) exactly for a bounded non-negative integer n.
- Integer totient: Compute Euler's totient function: the count of integers in [1, value] coprime to value.