{"uid":"cap_Z0I0kaOYJKmfigqEfqsgT","slug":"euler-totient-function-calculator-1f980f80","name":"Euler Totient Function Calculator","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).","url":"https://numtheory.openverbs.com/v1/totient","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":["n"],"properties":{"n":{"type":"string","pattern":"^\\d+$","description":"Positive integer ≤ 10^15 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_jcC39gxM562sZa3YSq57s","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 Euler's totient function φ(n) — the count of integers from 1 to n that are coprime with n","exampleAgentPrompt":"What is Euler's totient φ(n) for n = 999999999999937?","exampleUseCases":[{"title":"RSA key generation check","prompt":"I'm generating RSA keys and need to know the totient of my modulus n = 3233 — can you compute φ(3233) for me?"},{"title":"Modular inverse prerequisite","prompt":"Before I compute a modular inverse, I need φ(1000000007). Can you calculate Euler's totient for 1000000007?"},{"title":"Coprime count for large integer","prompt":"How many integers between 1 and 720720 are coprime with 720720? Give me the totient."}],"resultDescription":"Returns the Euler totient value φ(n): the count of positive integers up to n that share no common factors with n. The result is a non-negative integer.","failureModes":["n is not a valid positive integer string (pattern mismatch)","n exceeds 10^15 — value too large","n is zero or negative — invalid input","malformed JSON body missing required 'n' field","payment not included or insufficient (x402 payment required)"],"whenToPreferThis":"Choose this endpoint when you need a fast, accurate computation of Euler's totient function φ(n) for integers up to 10^15 — particularly useful in cryptographic workflows (RSA, Diffie-Hellman), modular arithmetic, and number theory research where computing φ(n) manually or symbolically would be slow or error-prone.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T00:40:01.607Z","isFirstParty":false}