Carmichael Function Calculator

Enter a positive integer n to compute λ(n) and φ(n).

How it is calculated

The tool factorises n by trial division, then works prime power by prime power.

For each pk in the factorisation: φ(pk) = pk−1(p − 1). The Carmichael value of that factor is the same, λ(pk) = φ(pk), with one exception: for powers of two with k ≥ 3, λ(2k) = 2k−2.

Then λ(n) = lcm of all the λ(pk), while φ(n) = product of all the φ(pk). n must be a whole number from 1 to 1,000,000,000; zero, negatives, decimals and larger numbers give no result. λ(1) and φ(1) are both 1. The result is always a divisor of φ(n).

Worked example

Take n = 561 = 3 × 11 × 17. Each prime appears once, so φ(3) = 2, φ(11) = 10, φ(17) = 16. Euler's φ(561) is their product: 2 × 10 × 16 = 320. The Carmichael function takes the least common multiple instead: lcm(2, 10, 16) = 80. So λ(561) = 80, a quarter of φ(561), and a^80 ≡ 1 (mod 561) for every a coprime to 561.

Try this example →

Common mistakes

  • Assuming λ(n) equals φ(n). They agree for primes and for 2, 4 and odd prime powers, but for composite n with several prime factors λ(n) is usually smaller (λ(15) = 4, φ(15) = 8).
  • Forgetting the special rule for powers of two. λ(8) is 2, not 4, and λ(16) is 4, not 8.
  • Multiplying the factor values together when computing λ. It is the least common multiple that is used; the product gives φ.
  • Entering a number beyond one billion or a decimal such as 2.5. The tool accepts only whole numbers up to 1,000,000,000.
  • Believing λ(n) is the smallest exponent for one chosen base a. It is the smallest exponent that works for every a coprime to n; a particular a may have a smaller order.

About this calculator

The Carmichael function λ(n), sometimes called the reduced totient, gives the smallest positive integer m such that a^m ≡ 1 (mod n) for every integer a that is coprime to n. It plays a similar role to Euler's totient φ(n) — which counts how many integers below n are coprime to n — but λ(n) is often smaller because it finds the true smallest universal exponent rather than just any exponent that happens to work; in fact λ(n) always divides φ(n).

This function matters in modular arithmetic and cryptography: RSA key generation can use λ(n) in place of φ(n) when deriving the private exponent, and because λ(n) is frequently smaller than φ(n), it can produce a smaller valid exponent for the same modulus, which is the basis of the Carmichael-based variant of the RSA key-generation formula. Number theorists also study λ(n) when analyzing the structure of the multiplicative group of integers modulo n and its cyclic subgroup decomposition.

Was this helpful?

You can pick up to 3 reactions.

Comments

  • Be the first to comment.

Popular calculators

All Calculators