{"uid":"cap_AljfYCzitQ-51fiyCCJVB","slug":"gcd-lcm-b-zout-coefficients-modular-inverse-deb354aa","name":"GCD, LCM, Bézout Coefficients & Modular Inverse","description":"Greatest common divisor, least common multiple, Bezout coefficients and modular inverse for integers of any size.","url":"https://math-stats.x402tookit.com/gcd-lcm?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":["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"}},"pairwiseCoprime":{"type":["boolean","null"]}}}}}}},"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_CP9SokMNps32JARqu7Xn0","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 greatest common divisor, least common multiple, Bézout coefficients, and modular inverse for a list of 2–20 integers of arbitrary size.","exampleAgentPrompt":"What's the GCD and LCM of 1024, 768, and 512? Also give me the Bézout coefficients for the first two numbers.","exampleUseCases":[{"title":"LCM for repeating event scheduling","prompt":"I have three tasks that repeat every 12, 18, and 30 days — find the LCM so I know when they all land on the same day again."},{"title":"Modular inverse for cryptographic key","prompt":"I need the modular inverse of 17 with modulus 3120 for an RSA calculation — can you compute it?"},{"title":"Verify coprimality of large integers","prompt":"Are 9007199254740991, 9007199254740881, and 1000000007 pairwise coprime? Also give me their GCD and LCM."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T13:08:16.340Z","isFirstParty":false,"canonicalSlug":"gcd-lcm-b-zout-coefficients-modular-inverse-deb354aa"}