Euler's Totient Function Calculator
Enter a positive integer below to calculate its Euler's Totient (Phi) function value.
Welcome to the Euler's Totient Function (Phi Function) Calculator! This tool helps you quickly determine the number of positive integers less than or equal to a given integer n that are relatively prime to n. This fundamental concept in number theory has significant applications, especially in cryptography and modular arithmetic.
What is Euler's Totient Function?
Euler's Totient Function, denoted as φ(n) or phi(n), is an arithmetic function that counts the number of positive integers up to a given integer n that are relatively prime to n. Two integers are relatively prime (or coprime) if their greatest common divisor (GCD) is 1. For example, for n=6, the positive integers less than or equal to 6 are 1, 2, 3, 4, 5, 6. The numbers relatively prime to 6 are 1 and 5 (GCD(1,6)=1, GCD(5,6)=1). So, φ(6) = 2.
Why is it Important?
- Number Theory: It's a cornerstone in elementary and analytic number theory, playing a role in theorems like Euler's Totient Theorem.
- Cryptography: It's crucial for the RSA encryption algorithm, one of the most widely used public-key cryptosystems. The security of RSA relies directly on the properties of Euler's totient function.
- Modular Arithmetic: It determines the order of the multiplicative group of integers modulo n, which is fundamental in various cryptographic and mathematical contexts.
How to Calculate Euler's Totient Function (φ(n))
The calculation of φ(n) depends on the prime factorization of n. If the prime factorization of n is given by n = p₁^k₁ * p₂^k₂ * ... * pᵣ^kᵣ, where p₁, p₂, ..., pᵣ are distinct prime numbers and k₁, k₂, ..., kᵣ are their positive integer exponents, then the formula for φ(n) is:
φ(n) = n * (1 - 1/p₁) * (1 - 1/p₂) * ... * (1 - 1/pᵣ)
Alternatively, this can be written as:
φ(n) = (p₁^k₁ - p₁^(k₁-1)) * (p₂^k₂ - p₂^(k₂-1)) * ... * (pᵣ^kᵣ - pᵣ^(kᵣ-1))
Or simplified:
φ(n) = p₁^(k₁-1)*(p₁-1) * p₂^(k₂-1)*(p₂-1) * ... * pᵣ^(kᵣ-1)*(pᵣ-1)
Examples:
- If n is a prime number (e.g., n=7): The only prime factor is 7.
φ(7) = 7 * (1 - 1/7) = 7 * (6/7) = 6.
(The numbers relatively prime to 7 are 1, 2, 3, 4, 5, 6.)
- If n is a power of a prime number (e.g., n=9 = 3²): The only prime factor is 3.
φ(9) = 9 * (1 - 1/3) = 9 * (2/3) = 6.
(The numbers relatively prime to 9 are 1, 2, 4, 5, 7, 8.)
- If n is a product of distinct primes (e.g., n=10 = 2 * 5): Prime factors are 2 and 5.
φ(10) = 10 * (1 - 1/2) * (1 - 1/5) = 10 * (1/2) * (4/5) = 10 * (4/10) = 4.
(The numbers relatively prime to 10 are 1, 3, 7, 9.)
- General Case (e.g., n=12 = 2² * 3): Prime factors are 2 and 3.
φ(12) = 12 * (1 - 1/2) * (1 - 1/3) = 12 * (1/2) * (2/3) = 12 * (2/6) = 12 * (1/3) = 4.
(The numbers relatively prime to 12 are 1, 5, 7, 11.)
Properties of Euler's Totient Function
- Multiplicativity: If
mandnare coprime, thenφ(mn) = φ(m)φ(n). - Euler's Totient Theorem: If
aandnare coprime positive integers, thena^φ(n) ≡ 1 (mod n). This is a generalization of Fermat's Little Theorem. - Sum over Divisors: The sum of the totients of the divisors of
nequalsn; i.e.,Σ_{d|n} φ(d) = n.
Using the Calculator
To use the calculator above:
- Enter a positive integer into the "Enter an integer (n)" field.
- Click the "Calculate Phi(n)" button.
- The result, prime factors used in the calculation, and a step-by-step breakdown will be displayed below.
Understanding Euler's Totient function is a gateway to deeper insights into number theory and its practical applications. We hope this calculator and explanation prove useful!