# agent402.tools Combinatorics Calculator

> agent402.tools Combinatorics Calculator is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Computes exact combinations C(n,r) or permutations P(n,r) using arbitrary-precision BigInt arithmetic, returning the result as a string and human-readable formula

## Facts

- Endpoint: POST https://agent402.tools/api/combinatorics
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-combinatorics-calculator-3056c540
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_FVvWr31tjjDtUHF-qvQMn

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-combinatorics-calculator-3056c540 -d '<json body>'
```

Example prompt: How many ways can I choose 6 numbers from a pool of 49? Calculate the combination C(49, 6) and give me the exact result.

## When to prefer this

Choose this endpoint when you need exact, arbitrary-precision combinatorics results that would overflow JavaScript's Number.MAX_SAFE_INTEGER — particularly for large n values (e.g. n > 60) where floating-point approximations would lose precision. Prefer over manual factorial computation or math libraries when you need a reliable, hosted solution with BigInt guarantees.

## Known failure modes

- r > n returns an error (invalid selection size)
- n or r outside 0–1000 range returns a validation error
- invalid type string (not 'combination' or 'permutation') returns a bad request error
- missing required parameters n or r returns a 400 error
- payment not included or insufficient returns 402 Payment Required

## How this service works

Compute combinations C(n, r) or permutations P(n, r) using BigInt for exact arbitrary-precision results. Returns the result as a string (since values can exceed Number.MAX_SAFE_INTEGER) and a human-readable formula.

## Output

Returns a JSON object containing the exact numeric result as a string (to handle values beyond Number.MAX_SAFE_INTEGER), the computation type (combination or permutation), and a human-readable formula like C(49,6) = 13,983,816

## Example request

```json
{
 "n": 49,
 "r": 6,
 "type": "combination"
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "n": {
   "type": "integer",
   "description": "Total items (0 to 1000)"
  },
  "r": {
   "type": "integer",
   "description": "Items chosen (0 to n)"
  },
  "type": {
   "type": "string",
   "description": "\"combination\" (default) or \"permutation\""
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "n": 10,
  "r": 3,
  "type": "combination",
  "result": "120",
  "formula": "C(10,3) = 10! / (3! × 7!)"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-combinatorics-calculator-3056c540/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
