# Crypto Math: GCD, LCM & Extended Euclidean (Bézout Coefficients)

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

Computes GCD, LCM, and extended Euclidean Bézout coefficients for two integers, with optional batch GCD/LCM over up to 20 additional numbers.

## Facts

- Endpoint: GET https://crypto-math.x402tookit.com/gcd-extended?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/crypto-math-gcd-lcm-extended-euclidean-b-zout-coefficients-56a1f248
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_L1VXcL10ARqac33PpJqQE

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 crypto-math-gcd-lcm-extended-euclidean-b-zout-coefficients-56a1f248
```

Example prompt: What's the GCD, LCM, and Bézout coefficients (x and y) for 252 and 198? Also tell me if they're coprime.

## When to prefer this

Choose this endpoint when you need number-theoretic operations — GCD, LCM, or Bézout coefficients — on big integers (decimal or hex), especially in cryptographic contexts like RSA, modular arithmetic, or CRT. It supports batch GCD/LCM over up to 22 numbers in a single call, which generic math APIs typically don't offer. Prefer it over language-level math libraries when operating within an agent pipeline that requires a pay-per-use HTTP interface without managing a compute environment.

## Known failure modes

- Missing required parameters a or b returns an error
- Non-integer or negative input values may return validation errors
- Providing more than 20 additional numbers in 'more' may be rejected
- Very large integers beyond supported bit width may time out or return an error
- Malformed hex input (invalid 0x prefix) may cause a parse error

## How this service works

gcd, lcm and extended-Euclid Bezout coefficients of two integers, plus gcd/lcm of up to 20 more.

## Output

Returns the GCD and LCM of the input integers as big-integer strings, Bézout coefficients x and y satisfying ax+by=gcd(a,b), a coprimality boolean, a human-readable summary and verdict, and optional degraded/disclaimer flags. For batches (via 'more'), GCD and LCM span all supplied numbers.

## 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": [
      "a",
      "b"
     ],
     "properties": {
      "a": {
       "type": "string",
       "description": "First non-negative whole number (decimal or 0x hex)"
      },
      "b": {
       "type": "string",
       "description": "Second non-negative whole number"
      },
      "more": {
       "type": "string",
       "description": "Comma-separated further non-negative numbers for the combined gcd and lcm (up to 20)"
      }
     }
    }
   },
   "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"
       ]
      },
      "source": {
       "type": [
        "null",
        "string"
       ]
      },
      "bezoutX": {
       "type": [
        "null",
        "string"
       ]
      },
      "bezoutY": {
       "type": [
        "null",
        "string"
       ]
      },
      "coprime": {
       "type": [
        "boolean",
        "null"
       ]
      },
      "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"
       }
      }
     }
    }
   }
  }
 }
}
```

## More

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