# GCD, LCM, Bézout Coefficients & Modular Inverse

> GCD, LCM, Bézout Coefficients & Modular Inverse is a paid API for AI agents from math-stats.x402tookit.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-29).

Computes greatest common divisor, least common multiple, Bézout coefficients, and modular inverse for a list of 2–20 integers of arbitrary size.

## Facts

- Endpoint: GET https://math-stats.x402tookit.com/gcd-lcm?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/gcd-lcm-b-zout-coefficients-modular-inverse-deb354aa
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_AljfYCzitQ-51fiyCCJVB

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 gcd-lcm-b-zout-coefficients-modular-inverse-deb354aa
```

Example prompt: What's the GCD and LCM of 1024, 768, and 512? Also give me the Bézout coefficients for the first two numbers.

## When to prefer this

Choose this endpoint when you need exact, arbitrary-precision integer GCD or LCM (not floating-point approximations), need Bézout coefficients for extended Euclidean algorithm results, need modular inverses for cryptographic or modular arithmetic workflows, or need to check whether a set of integers is pairwise coprime. Prefer it over general-purpose computation tools when dealing with very large integers beyond JavaScript's native safe integer range.

## Known failure modes

- Missing 'numbers' query parameter returns an error
- Fewer than 2 integers supplied causes a validation failure
- Modular inverse does not exist if GCD of number and modulus is not 1 (non-coprime inputs)
- Integers exceeding supported size limits may be rejected
- Non-integer or malformed values in the numbers list return a parse error
- Payment not included or insufficient returns HTTP 402

## How this service works

Greatest common divisor, least common multiple, Bezout coefficients and modular inverse for integers of any size.

## Output

Returns the GCD and LCM of all supplied integers as arbitrary-precision strings, Bézout coefficients (x, y) and the identity equation for the first two numbers, the modular inverse of the first number if a modulus was provided, a pairwise coprime boolean, a human-readable summary, and any reasons or warnings if the computation was degraded or incomplete.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "numbers"
     ],
     "properties": {
      "modulus": {
       "type": "string",
       "description": "Optional modulus m to find the modular inverse of the first number"
      },
      "numbers": {
       "type": "string",
       "description": "2 to 20 integers separated by commas or spaces"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "gcd": {
       "type": [
        "null",
        "string"
       ]
      },
      "lcm": {
       "type": [
        "null",
        "string"
       ]
      },
      "asOf": {
       "type": [
        "null",
        "string"
       ]
      },
      "bezout": {
       "type": [
        "null",
        "object"
       ],
       "properties": {
        "x": {
         "type": [
          "null",
          "string"
         ]
        },
        "y": {
         "type": [
          "null",
          "string"
         ]
        },
        "identity": {
         "type": [
          "null",
          "string"
         ]
        }
       }
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "numbers": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "reasons": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
      },
      "summary": {
       "type": [
        "null",
        "string"
       ]
      },
      "verdict": {
       "type": [
        "null",
        "string"
       ]
      },
      "degraded": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "disclaimer": {
       "type": [
        "null",
        "string"
       ]
      },
      "notChecked": {
       "type": [
        "array",
        "null"
       ],
       "items": {
        "type": "string"
       }
… (truncated)
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/gcd-lcm-b-zout-coefficients-modular-inverse-deb354aa/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from math-stats.x402tookit.com](https://www.zero.xyz/host/math-stats.x402tookit.com/llms.txt)
