{"uid":"cap_L1VXcL10ARqac33PpJqQE","slug":"crypto-math-gcd-lcm-extended-euclidean-b-zout-coefficients-56a1f248","name":"Crypto Math: GCD, LCM & Extended Euclidean (Bézout Coefficients)","description":"gcd, lcm and extended-Euclid Bezout coefficients of two integers, plus gcd/lcm of up to 20 more.","url":"https://crypto-math.x402tookit.com/gcd-extended?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"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"}}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_Pjpd1Om2tc_oYGd6tCF_B","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes GCD, LCM, and extended Euclidean Bézout coefficients for two integers, with optional batch GCD/LCM over up to 20 additional numbers.","exampleAgentPrompt":"What's the GCD, LCM, and Bézout coefficients (x and y) for 252 and 198? Also tell me if they're coprime.","exampleUseCases":[{"title":"Checking coprimality for RSA key generation","prompt":"I need to verify that 65537 and 1073741820 are coprime before using them in an RSA setup — can you give me their GCD and Bézout coefficients?"},{"title":"Finding LCM for scheduler sync intervals","prompt":"What's the least common multiple of 12, 18, and 24? I need to know when three periodic tasks will next fire at the same time."},{"title":"Extended Euclidean for modular inverse setup","prompt":"Run the extended Euclidean algorithm on 35 and 64 and give me the Bézout x and y values so I can find a modular inverse."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:13:45.281Z","isFirstParty":false,"canonicalSlug":"crypto-math-gcd-lcm-extended-euclidean-b-zout-coefficients-56a1f248"}