{"uid":"cap_Asi09zNY46zbyC3YkrfOm","slug":"number-theory-modular-exponentiation-modpow-523722cb","name":"Number Theory Modular Exponentiation (modpow)","description":"Compute (base ^ exponent) mod modulus efficiently for arbitrary-precision integers. The modulus must be positive.","url":"https://numtheory.openverbs.com/v1/modpow","method":"POST","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","bodyType","body"],"properties":{"body":{"type":"object","required":["base","exponent","modulus"],"properties":{"base":{"type":"string","pattern":"^\\d+$","description":"Non-negative base as a decimal string."},"modulus":{"type":"string","pattern":"^\\d+$","description":"Positive modulus as a decimal string."},"exponent":{"type":"string","pattern":"^\\d+$","description":"Non-negative exponent as a decimal string."}},"additionalProperties":false},"type":{"type":"string","const":"http"},"method":{"enum":["POST"],"type":"string"},"bodyType":{"enum":["json","form-data","text"],"type":"string"}},"additionalProperties":false}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.004","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.004/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.004","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_rSgkW5ks8gUa_dn80wrN3","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.004","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes modular exponentiation: (base ^ exponent) mod modulus for arbitrarily large integers supplied as decimal strings.","exampleAgentPrompt":"Can you compute 7 raised to the power of 256, mod 1000000007? I need the result as a decimal integer.","exampleUseCases":[{"title":"RSA encryption key verification","prompt":"For an RSA check, compute 65537 to the power of 3233 mod 3233 — I need the modular exponentiation result to verify my key pair."},{"title":"Fermat primality test step","prompt":"Run a Fermat primality test step for me: compute 2 to the power of 104728 (which is n-1) mod 104729 and tell me if the result is 1."},{"title":"Diffie-Hellman shared secret","prompt":"In a Diffie-Hellman exchange, the generator is 5, the private exponent is 87234, and the prime modulus is 23. What is 5 to the power of 87234 mod 23?"}],"resultDescription":"Returns the computed value of (base ^ exponent) mod modulus as a decimal string, supporting arbitrarily large integers.","failureModes":["Non-numeric or negative base/exponent/modulus strings rejected with validation error","Modulus of zero causes division-by-zero / invalid input error","Missing required fields (base, exponent, or modulus) return 400-level schema validation error","Payment not settled returns 402 Payment Required","Extremely large inputs may time out or return a compute-limit error"],"whenToPreferThis":"Choose this endpoint when you need server-side modular exponentiation on arbitrarily large integers without implementing big-integer libraries locally — especially for cryptographic primitives (RSA, Diffie-Hellman, primality testing) or number-theory computations where JavaScript/Python native integers may overflow or be slow. Prefer it over general-purpose math APIs when the specific operation is modpow and inputs are provided as decimal strings.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-14T18:30:24.221Z","isFirstParty":false}