{"openapi":"3.1.0","info":{"title":"Number Theory","version":"0.1.0","description":"Elementary number theory on arbitrary-precision integers — GCD and LCM, prime factorization, primality testing, Euler's totient, and modular exponentiation.","x-guidance":"Elementary number theory on arbitrary-precision integers — GCD and LCM, prime factorization, primality testing, Euler's totient, and modular exponentiation. Each operation is an HTTP POST to its /v1/<operation> path with a JSON request body (see each operation's requestBody schema) and returns a JSON response. Endpoints are paid per successful call via x402 or MPP (USDC on Base); an unpaid request returns 402 with payment metadata in the WWW-Authenticate header.","contact":{"email":"hello@openverbs.com"}},"x-discovery":{"ownershipProofs":["0xb1401a71756f51464a9962db12f1eb3e9522490cd20010b06d00cf7b7770acfd5f79721f9dfdf2643f8cecd29af3bde9ec133941a386042b32d9886053a70de61b","0xc1c1f11793e18a00fcb7072421f26e89fb75b6aa517fa84370564991f4b10efa024f6f57e4e67eefd20cf46cc01fc5a62d793fa8fbcda04f26c946a3433d73f91b","0x676b474af0ef9ed4809b5d12d2e789b36e52d56215b21f601d71f76620e36ec630347116a7b2b349a3c3681e5db0fbfa76c4169a676b6d6f27864d0e5017284a1c","0xc2ab96522515ed9e9bc4f1a241b774bd48df42e951ddbf7f6aa8fc76f5a96a20421703e1ec402ce7eb1e4eabea3b6e4e4129cf39d56ea91cf4fcf38561fc94fc1c"]},"servers":[{"url":"https://numtheory.openverbs.com"}],"paths":{"/health":{"get":{"summary":"Health check","security":[],"responses":{"200":{"description":"Healthy","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"service":{"type":"string"},"version":{"type":"string"}}}}}}}}},"/v1/gcd":{"post":{"summary":"Greatest common divisor","description":"Greatest common divisor of two or more non-negative integers (arbitrary precision). Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["greatest common divisor","compute gcd","gcd api","common divisor lookup","integer gcd","bigint gcd"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"values":{"type":"array","minItems":2,"maxItems":256,"items":{"type":"string","pattern":"^\\d+$"},"description":"Two or more non-negative integers as decimal strings."}},"required":["values"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ result }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Greatest common divisor of two or more non-negative integers (arbitrary precision).","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Greatest common divisor of two or more non-negative integers (arbitrary precision).","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Greatest common divisor of two or more non-negative integers (arbitrary precision).","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/lcm":{"post":{"summary":"Least common multiple","description":"Least common multiple of two or more positive integers (arbitrary precision). Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["least common multiple","compute lcm","lcm api","common multiple lookup","integer lcm","bigint lcm"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"values":{"type":"array","minItems":2,"maxItems":256,"items":{"type":"string","pattern":"^\\d+$"},"description":"Two or more non-negative integers as decimal strings."}},"required":["values"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ result }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Least common multiple of two or more positive integers (arbitrary precision).","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Least common multiple of two or more positive integers (arbitrary precision).","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Least common multiple of two or more positive integers (arbitrary precision).","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/factorize":{"post":{"summary":"Prime factorization","description":"Prime-factorize a positive integer (≤ 10^15 so the computation is always fast). Returns the prime factors with exponents, the divisor count, and whether n is prime. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["prime factorization","factor integer","integer factors api","prime factors lookup","divisor count","factorize number"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Positive integer ≤ 10^15 as a decimal string."}},"required":["n"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ n, factors:[{prime,exponent}], isPrime, divisorCount }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ n, factors:[{prime,exponent}], isPrime, divisorCount }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Prime-factorize a positive integer (≤ 10^15 so the computation is always fast). Returns the prime factors with exponents, the divisor count, and whether n is prime.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Prime-factorize a positive integer (≤ 10^15 so the computation is always fast). Returns the prime factors with exponents, the divisor count, and whether n is prime.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Prime-factorize a positive integer (≤ 10^15 so the computation is always fast). Returns the prime factors with exponents, the divisor count, and whether n is prime.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/is-prime":{"post":{"summary":"Primality test","description":"Miller-Rabin primality test (with witnesses that are exact for all 64-bit integers) on an arbitrary-precision integer. Returns { prime }. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["primality test","check prime number","is prime api","miller rabin test","validate prime","prime lookup"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Non-negative integer as a decimal string."}},"required":["n"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ prime }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ prime }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Miller-Rabin primality test (with witnesses that are exact for all 64-bit integers) on an arbitrary-precision integer. Returns { prime }.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Miller-Rabin primality test (with witnesses that are exact for all 64-bit integers) on an arbitrary-precision integer. Returns { prime }.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Miller-Rabin primality test (with witnesses that are exact for all 64-bit integers) on an arbitrary-precision integer. Returns { prime }.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/totient":{"post":{"summary":"Euler's totient","description":"Euler's totient φ(n) — the count of integers in [1, n] coprime to n — for a positive integer ≤ 10^15 (it is computed from the prime factorization). Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["euler totient","compute phi","totient function","coprime count","number theory totient","totient api"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Positive integer ≤ 10^15 as a decimal string."}},"required":["n"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ totient }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ totient }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Euler's totient φ(n) — the count of integers in [1, n] coprime to n — for a positive integer ≤ 10^15 (it is computed from the prime factorization).","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Euler's totient φ(n) — the count of integers in [1, n] coprime to n — for a positive integer ≤ 10^15 (it is computed from the prime factorization).","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Euler's totient φ(n) — the count of integers in [1, n] coprime to n — for a positive integer ≤ 10^15 (it is computed from the prime factorization).","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}},"/v1/modpow":{"post":{"summary":"Modular exponentiation","description":"Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive. Paid endpoint (x402 + MPP). Price: $0.004000 USDC per successful payment.","tags":["modular exponentiation","mod pow","compute base exponent mod","fast modular power","modular arithmetic api","bigint modpow"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"base":{"type":"string","pattern":"^\\d+$","description":"Non-negative base as a decimal string."},"exponent":{"type":"string","pattern":"^\\d+$","description":"Non-negative exponent as a decimal string."},"modulus":{"type":"string","pattern":"^\\d+$","description":"Positive modulus as a decimal string."}},"required":["base","exponent","modulus"],"additionalProperties":false}}}},"responses":{"200":{"description":"`{ result }`.","content":{"application/json":{"schema":{"type":"object","description":"`{ result }`."}}}},"400":{"description":"Invalid request; no payment is attempted"},"402":{"description":"Payment required; x402/MPP metadata returned in headers"},"502":{"description":"Upstream provider error after payment verification"}},"x-payment-info":{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive.","method":"tempo","preferredOffer":"mpp-tempo","price":{"mode":"fixed","currency":"USD","amount":"0.004000"},"protocols":[{"x402":{"scheme":"exact","network":"eip155:8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"evm","intent":"charge","network":"8453","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}},{"mpp":{"method":"tempo","intent":"charge","network":"4217","currency":"0x20c000000000000000000000b9537d11c60e8b50","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}}],"network":"4217","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A","offers":[{"amount":"4000","currency":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","description":"Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive.","intent":"charge","method":"evm","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"},{"amount":"4000","currency":"0x20c000000000000000000000b9537d11c60e8b50","description":"Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive.","intent":"charge","method":"tempo","recipient":"0xb3f4de103F34b99f0Da19B4F16D6B53a14C2194A"}]}}}},"x-service-info":{"categories":["compute"],"docs":{"homepage":"https://numtheory.openverbs.com","apiReference":"https://numtheory.openverbs.com/openapi.json"}}}