How this calculation works
The Carmichael lambda function is the least positive exponent that sends every invertible residue modulo n to one. This page factors the entered integer, computes that exponent for each prime-power component and combines the components by least common multiple. It also reports Euler’s totient, which counts invertible residue classes rather than their least universal exponent. All arithmetic remains integral, and the special power-of-two rule is applied explicitly.
λ(n)=lcm_i λ(p_i^k_i); λ(p^k)=φ(p^k) for odd p, while λ(2^k)=2^(k−2) for k≥3.A worked example
The modulus 561 factors as 3*11*17. Its prime-power exponents are λ(3)=2, λ(11)=10 and λ(17)=16, so λ(561)=lcm(2,10,16)=80. Euler’s totient is 2*10*16=320. Every residue coprime to 561 raised to the eightieth power is one modulo 561, even though the modulus is composite. The smaller exponent does not assert that all residues, including multiples of three, eleven or seventeen, obey that identity.
Good to know
Positive integer moduli through 10¹², entered as base-ten digits. Bounded trial division supplies the exact prime factors. The convention is λ(1)=1. The universal-exponent statement applies to units only, meaning bases coprime to n. This page does not test primality by exponentiation, generate cryptographic parameters or factor arbitrary-size integers. Very large cryptographic moduli require different factorization methods and are outside the accepted range.
Reference: Wolfram MathWorld — Carmichael function and prime-power formula (opens in a new tab) ↗
The universal exponent is an LCM, not a count of residues
The multiplicative order of any one unit divides λ(n), and λ(n) is the least exponent that works for all units together. Different prime-power components can have overlapping exponent factors. Taking their product would repeat those factors unnecessarily, while an LCM retains just enough of each prime power. The default factors two, ten and sixteen therefore combine to eighty, not three hundred twenty.
Euler’s φ(n) counts the group elements, and λ(n) divides φ(n). Equality holds for many moduli but is not a rule for every input. For n=8, the units are 1,3,5,7 and each squares to one, so λ(8)=2 while φ(8)=4. For n=16 the least universal exponent is four rather than eight. These small examples expose the special behavior of higher powers of two without requiring a large factorization.
The Sum of two squares calculator for integer representations uses prime-factor information to test a different integer-representation condition.
A composite modulus can satisfy strong-looking exponent identities
A statement about all units does not make the modulus prime. The default 561 is a classic composite example whose factorization is visible in the table. Since λ(561) divides 560, its coprime bases also satisfy a^(560)=1 modulo 561. Treating that congruence alone as a proof of primality would therefore be invalid. The output is an exact number-theory function, not an assurance that a modular arithmetic system is cryptographically safe.
The input n=1 has an empty prime-power factorization, and this page assigns λ(1)=1 as the conventional initial value. It does not create a fictional prime factor to fill the table. The n=2 and n=4 cases also remain separate from the k≥3 power-of-two formula; applying 2^(k−2) blindly at k=1 would not even give a positive integer. The steps identify that boundary so the returned value can be reproduced by hand.
A few questions, answered
Can I reduce every exponent modulo λ(n)?
For modular powers with a base coprime to n, exponent reduction follows the unit-group period. A noncoprime base needs additional analysis; this page does not silently apply the same rule to it.
Is λ(n) always attained as the order of some unit?
For the finite abelian unit group there is an element whose order is its exponent, but this page computes λ by prime powers and LCM. It does not search for or return such a unit.