# Integer binomial coefficient

`integer-binomial-coefficient` · version 1.0.0 · Numbers & math · free, no key needed

Compute the exact binomial coefficient C(n, k), the number of ways to choose k items from n.

**Use when you need to: integer binomial coefficient · n choose k · combinations count.**

## Supported

- integer binomial coefficient
- n choose k
- combinations count

## Not supported

- permutations count
- multinomial coefficient
- negative n or k

## Behavior

- n and k are JSON integers with 0 <= k <= n <= 100000.
- The result is C(n, k) = n! / (k! * (n-k)!), computed exactly via an incremental multiply-then-exact-divide loop (never materializing n! itself), never floating point.
- C(n, 0) and C(n, n) are 1 for every valid n.
- Requests whose exact result would exceed 1000 digits are rejected rather than truncated.

## Input

- `n` (integer, required): min 0; max 100000
- `k` (integer, required): min 0; max 100000

## Output

- `value` (string, required)

## Limits

- max n: 100000
- max digits: 1000

## Example

Request input:

```json
{
  "n": 5,
  "k": 2
}
```

Response:

```json
{
  "result": {
    "value": "10"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "integer-binomial-coefficient",
  "version": "1.0.0",
  "input": {
    "n": 5,
    "k": 2
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/integer-binomial-coefficient/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"n":5,"k":2}'
```

The machine-readable contract is at [/v1/tools/integer-binomial-coefficient/versions/1.0.0](/v1/tools/integer-binomial-coefficient/versions/1.0.0).

### CLI

```sh
node cli.mjs run integer-binomial-coefficient 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Integer permutations count](/tools/integer-permutations-count): Compute the exact number of k-permutations of n distinct items, P(n, k) = n! / (n-k)!.
- [Array integer GCD](/tools/array-integer-gcd): Compute the non-negative greatest common divisor of an array of canonical integer strings.
- [Array integer LCM](/tools/array-integer-lcm): Compute the non-negative least common multiple of an array of canonical integer strings.
- [Integer derangements count](/tools/integer-derangements-count): Compute !n, the number of derangements (permutations with no fixed point) of n items, exactly.
- [Integer factorial](/tools/integer-factorial): Compute n! (n factorial) exactly for a bounded non-negative integer n.
- [Integer totient](/tools/integer-totient): Compute Euler's totient function: the count of integers in [1, value] coprime to value.
