ForHosting KIT · Math

Carmichael function calculator

λ(15) is 4: any number coprime to 15, raised to the 4th power, leaves remainder 1 when divided by 15, while Euler's φ(15) is 8. Enter a positive integer of up to 18 digits to get λ(n) and its prime factorization. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
N
15
You get
Lambda
4
Omega
2

The Carmichael function λ(n) answers a sharper question than Euler's totient: what is the smallest positive exponent m such that every integer a coprime to n satisfies a^m ≡ 1 (mod n)? That single integer is the exponent of the multiplicative group of units modulo n, and it appears in RSA key schedules, primality-related proofs, and classroom exercises on modular orders. This calculator takes a positive integer, factors it deterministically with BigInt arithmetic, applies the prime-power formula for λ, and returns the least common multiple as an exact decimal string.

What the Carmichael function measures

Euler's totient φ(n) counts how many residue classes modulo n are coprime to n; Carmichael's λ(n) is the exponent of that group — the least common multiple of the orders of all units. By definition λ(n) always divides φ(n), and for primes and twice-odd-primes the two functions coincide, but for powers of two and for products of several prime powers λ is often strictly smaller.

The closed form is elementary once the prime factorization of n is known: λ(1) equals 1; λ(2) equals 1 and λ(4) equals 2; for higher powers of two λ(2^k) equals 2^{k-2}; for an odd prime power λ(p^k) equals φ(p^k) equals p^{k-1}(p-1); and for a general n the global value is the LCM of the local values on each prime-power factor.

Knowing λ(n) lets you bound the order of any a coprime to n without testing every candidate exponent, which is why number-theory courses and cryptographic demos treat it as a first-class companion to the totient.

Where λ(n) shows up in practice

Feed λ(n) into proofs that a generator has maximal order, check that a proposed universal exponent really annihilates every unit, or document the group exponent of hash-table sizes and challenge moduli. Pipeline authors can chain this calculator after a factorization step or call it alone when only the exponent is required. The structured factors in the response also double as a free prime-power breakdown for any follow-up totient or radical calculation you run next.

Homework and contest modular-order checks

Verify student or contest answers for the exponent of (Z/nZ)* by comparing returned λ(n) against hand-worked LCM-of-local values.

RSA and cryptography classroom demos

Show that λ(n) can be strictly smaller than φ(n) on powers of two and multi-prime products used in toy RSA moduli.

Pipeline number-theory helpers

Emit exact λ(n) plus prime powers for order bounds, totient cross-checks, or batch exponent tables in automated math pipelines.

Is the Carmichael function calculator free?

The browser tool runs free on your device.

How does λ(n) differ from Euler's totient φ(n)?

φ(n) counts units modulo n; λ(n) is the exponent of that group. λ(n) always divides φ(n) and is often smaller for powers of two and multi-prime n.

What does λ(n) tell me in practice?

It is a universal exponent: every number coprime to n, raised to λ(n), leaves remainder 1. That bounds the order of any such number without testing every candidate exponent one by one.

How is λ(n) calculated?

Factor n into prime powers, take the local value of each, and combine them with the least common multiple. For 15, the parts 3 and 5 give 2 and 4, so λ(15) is 4.

How large a number can I enter?

Any positive whole number of up to 18 decimal digits, written without commas, spaces or scientific notation. Beyond that size the calculation stops at once instead of attempting an impractical search.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/numth/carmichael-function

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/numth/carmichael-function \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"n":"15"}'
{
  "n": "15"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "numth.carmichael_function",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_digits18
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Results never depend on floating-point rounding, network calls, or wall-clock time, so the free browser path and the prepaid API path produce identical JSON for the same n.

What the Carmichael function measures

This endpoint returns that integer together with the factorization it used, so you can audit every step of the derivation rather than trusting an opaque black box.

How to call the calculator and read λ(n)

Submit a single field n — a safe JavaScript integer or a plain decimal string without commas, spaces, or scientific notation. Internally the engine promotes n to BigInt, factors it with a 6k±1 trial-division wheel up to the square root of the remaining cofactor, evaluates the local Carmichael formula on each prime power, and folds those locals with an exact LCM. The response carries n and lambda as decimal strings, a factors array of ascending { base, exponent } pairs (empty when n is 1), and omega as the count of distinct prime bases. Values must be integers at least 1; zero, negatives, and fractions are rejected with invalid_input and are never charged. Alias field names number and value are accepted for convenience. Stay within the published digit limit of eighteen decimal digits; beyond that bound the request fails fast rather than burning CPU on an intractable search.

Where λ(n) shows up in practice

Failed validation never consumes balance; only successful computations bill the published $0.002. Use the browser tool for interactive exploration of small and medium n, and the API when a backend, notebook, or batch job must compute λ for many integers under a single prepaid KIT balance without a subscription.

How do I compute the Carmichael function λ(n) with this API?

POST an object with field n set to an integer ≥ 1 (or a decimal string). The response returns lambda as a decimal string, plus factors and omega.

Why must n be at least 1?

λ(n) is defined for positive integers. Zero and negatives are rejected with invalid_input rather than inventing a convention; λ(1) is defined as 1.

Is the result deterministic across browser and API?

Yes. The same pure factor-and-LCM routine powers both paths, so identical inputs produce identical JSON with no network or randomness involved.

Read the full KIT documentation →