Euler Totient Function φ(n)
Compute Euler totient φ(n).
φ(n) = —
Euler's totient function
Euler's totient φ(n) counts the integers in [1, n] that are coprime with n — that is, share no prime factor with it. For a prime p, every smaller positive integer is coprime, so φ(p) = p − 1. The function is multiplicative: if n = p₁^a₁ · p₂^a₂ · … is the prime factorisation, then φ(n) = n · ∏(1 − 1/pᵢ). Examples: φ(12) = 12 · (1 − 1/2) · (1 − 1/3) = 4 (the integers 1, 5, 7, 11). For two distinct primes p ≠ q, φ(p · q) = (p − 1)(q − 1) — the identity at the heart of RSA. Euler's theorem generalises Fermat's little theorem: a^φ(n) ≡ 1 (mod n) whenever gcd(a, n) = 1.
Where the totient shows up
- RSA — key generation picks primes
p, q, computesn = p · qandφ(n) = (p − 1)(q − 1), then derives the private exponentd ≡ e^(−1) (mod φ(n)). - Order of elements in the multiplicative group
(ℤ/nℤ)*— which has exactlyφ(n)elements. - ElGamal and other discrete-log cryptosystems rely on the group structure that the totient describes.
- Counting reduced fractions with denominator
nin lowest terms — there are exactlyφ(n)of them.
FAQ
Why is φ(n) hard to compute without knowing the factorisation? Because it requires the prime factors of n. Recovering φ(n) from n alone is equivalent to factoring n — and is what makes RSA secure.
What is φ(1)? By convention φ(1) = 1: the only integer in [1, 1] is 1 itself, and gcd(1, 1) = 1.
Is the totient always even for n > 2? Yes — every n > 2 has at least one factor of (p − 1) with p odd or contributes a factor of 2 from 2^k.
How does it relate to Carmichael's function? Carmichael's λ(n) is the smallest exponent for which a^λ(n) ≡ 1; it always divides φ(n) and is often used in modern RSA implementations instead of φ.
Related Tools
Euler's Totient Function φ(n)
Enter an integer n and get the count of integers from 1 to n that are coprime with n, computed by prime factorization: n = 36 returns 12.
Savings Income MPC MPS
Computes total and marginal savings from income using MPC and MPS=1-MPC.
Leverett J-Function
Calculates the Leverett J-function, which normalises capillary pressure by interfacial tension, contact angle and the square root of the permeability-to-porosity ratio. It collapses capillary pressure curves from samples with different properties onto a single rock-type curve. Enter the capillary pressure, interfacial tension, contact angle, permeability in millidarcy and porosity.
Function Animation
Visualize and animate mathematical functions f(x, t) in real time. The parameter t varies automatically — perfect for waves, trig functions and dynamic equations.
Euler Column Buckling
Computes critical buckling load (Pcr) of a slender column using Euler formula.
Numeric Function Limit
Computes numeric two-sided limit of a function as x approaches a value.
The results provided by this tool are for general informational and educational purposes only and do not constitute professional, financial, medical, legal, tax or accounting advice. Always confirm important decisions with a qualified professional and official sources.