# Euler Totient Function Calculator

> Euler Totient Function Calculator is a paid API for AI agents from numtheory.openverbs.com, paid per call via x402, $0.004/call, status unknown (last checked 2026-09-15).

Computes Euler's totient function φ(n) — the count of integers from 1 to n that are coprime with n

## Facts

- Endpoint: POST https://numtheory.openverbs.com/v1/totient
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/euler-totient-function-calculator-1f980f80
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_Z0I0kaOYJKmfigqEfqsgT

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability euler-totient-function-calculator-1f980f80 -d '<json body>'
```

Example prompt: What is Euler's totient φ(n) for n = 999999999999937?

## When to prefer this

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.

## Known failure modes

- 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)

## How this service works

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).

## Output

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.

## Request schema (JSON Schema)

```json
{
 "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
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/euler-totient-function-calculator-1f980f80/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from numtheory.openverbs.com](https://www.zero.xyz/host/numtheory.openverbs.com/llms.txt)
