Euler's Totient Function Calculator
Count the positive integers up to n that are coprime to n in MiniWebtool’s Euler's Totient Function Calculator. Prime factorization and a coprime grid explain the resulting φ(n).
For Gemini, paste the copied question into the chat. You can also copy it below.Need help using this tool? Ask AI
View the question
Enter n below to get φ(n) with the prime factorization steps and a grid of the coprime numbers.
About Euler's Totient Function Calculator
Welcome to the Euler's Totient Function Calculator, a comprehensive number theory tool that computes φ(n) (Euler's phi function) with step-by-step prime factorization, interactive coprime number grid visualization, and in-depth analysis. Whether you are studying abstract algebra, preparing for math competitions, working on RSA cryptography, or exploring modular arithmetic, this calculator delivers professional-grade computation with rich educational content.
At a Glance
Euler's Totient Function Calculator counts the positive integers up to n that are coprime to n, giving φ(n) for any whole number from 1 to 1,000,000. It shows the prime factorization and the formula steps.
| Feature | What you get | Good for |
|---|---|---|
| Input range | Enter any positive integer from 1 to 1,000,000, or click a quick example such as a prime, composite or RSA-style semiprime. | Computing φ(n) for coursework or number theory |
| Product formula | Shows the prime factorization and applies φ(n) = n × product of (1 − 1/p) over each distinct prime p. | Seeing how φ(n) is derived |
| Coprime grid | For n up to 400, an animated grid marks which numbers are coprime to n. | Visualizing which numbers share no factor with n |
| Trend chart | Plots φ(k) for k from 1 to the smaller of n and 100. | Seeing how the totient jumps between values |
| Result details | Gives the coprime ratio, a list of coprime integers and detected properties for primes and prime powers. | Checking special cases such as φ(p) = p − 1 |
| RSA connection | For a product of two primes, shows how φ(n) = (p − 1)(q − 1) is used in RSA. | Studying the math behind RSA keys |
What is Euler's Totient Function?
Euler's totient function φ(n), also known as Euler's phi function, counts the number of positive integers from 1 to n that are relatively prime (coprime) to n. Two numbers are coprime when their greatest common divisor (GCD) equals 1.
For example, φ(12) = 4 because exactly four numbers — 1, 5, 7, and 11 — are coprime to 12 among the integers from 1 to 12.
The Product Formula
The most efficient way to compute φ(n) uses the prime factorization of n. If \(n = p_1^{a_1} \cdot p_2^{a_2} \cdots p_k^{a_k}\), then:
This means we multiply n by \((1 - 1/p)\) for each distinct prime factor p of n. The exponents do not matter — only the distinct primes.
Key Properties
Euler's Theorem
Euler's theorem is the key result that makes the totient function crucial in cryptography:
This generalizes Fermat's little theorem (which is the special case when n is prime). It forms the mathematical foundation of RSA encryption.
How to Use This Calculator
- Enter a positive integer: Type any value from 1 to 1,000,000 in the input field.
- Use quick examples: Click the example buttons to try classic values like primes, composite numbers, or RSA-style semiprimes.
- View your results: The calculator shows φ(n), prime factorization, coprime ratio, and detected properties.
- Explore the coprime grid: For n ≤ 400, see which numbers are coprime to n in an animated visual grid.
- Study the trend chart: See how φ(k) varies for k = 1 to min(n, 100).
RSA Encryption Connection
In RSA cryptography, Euler's totient function plays a central role:
- Choose two large primes p and q. Compute n = p × q.
- Compute φ(n) = (p−1)(q−1).
- Choose public exponent e with gcd(e, φ(n)) = 1.
- Compute private exponent d such that e × d ≡ 1 (mod φ(n)).
The security of RSA relies on the difficulty of computing φ(n) without knowing the factorization of n. If an attacker could efficiently compute φ(n), they could break RSA.
Common Values of φ(n)
| n | φ(n) | Coprime integers | Notes |
|---|---|---|---|
| 1 | 1 | {1} | By definition |
| 2 | 1 | {1} | Prime |
| 6 | 2 | {1, 5} | 2 × 3 |
| 10 | 4 | {1, 3, 7, 9} | 2 × 5 |
| 12 | 4 | {1, 5, 7, 11} | 2² × 3 |
| 15 | 8 | {1, 2, 4, 7, 8, 11, 13, 14} | 3 × 5 |
| 30 | 8 | {1, 7, 11, 13, 17, 19, 23, 29} | 2 × 3 × 5 |
| 100 | 40 | — | 2² × 5² |
Frequently Asked Questions
What is Euler's totient function?
Euler's totient function φ(n), also called Euler's phi function, counts the number of positive integers from 1 to n that are relatively prime (coprime) to n. Two numbers are coprime when their greatest common divisor (GCD) is 1. For example, φ(12) = 4 because only 1, 5, 7, and 11 are coprime to 12.
How do you calculate Euler's totient function?
To calculate φ(n): (1) Find the prime factorization of n. (2) Apply the product formula: φ(n) = n × ∏(1 − 1/p) for each distinct prime factor p of n. For example, φ(12) = 12 × (1−1/2) × (1−1/3) = 12 × 1/2 × 2/3 = 4. For a prime p, φ(p) = p−1. For a prime power p^k, φ(p^k) = p^k − p^(k−1).
Why is Euler's totient function important in RSA encryption?
In RSA encryption, the modulus n = p × q is the product of two large primes. The totient φ(n) = (p−1)(q−1) is used to compute the private key: the decryption exponent d must satisfy e × d ≡ 1 (mod φ(n)), where e is the public encryption exponent. Without knowing φ(n) — which requires factoring n — computing d is computationally infeasible.
What is Euler's theorem and how does it relate to the totient function?
Euler's theorem states that if a and n are coprime, then a^φ(n) ≡ 1 (mod n). This is a generalization of Fermat's little theorem (which applies when n is prime). It is fundamental in modular arithmetic and cryptography, providing the mathematical basis for RSA encryption and efficient modular exponentiation.
What are the key properties of Euler's totient function?
Key properties include: (1) φ(1) = 1. (2) For prime p: φ(p) = p−1. (3) For prime power p^k: φ(p^k) = p^(k−1)(p−1). (4) Multiplicative property: if gcd(m,n) = 1, then φ(m×n) = φ(m)×φ(n). (5) Sum over divisors: Σ φ(d) = n for all divisors d of n. (6) φ(n) is always even for n > 2.
What does it mean for two numbers to be coprime?
Two integers a and b are coprime (also called relatively prime) if their greatest common divisor is 1, meaning they share no common prime factors. For example, 8 and 15 are coprime because gcd(8,15) = 1, even though neither is prime. The totient function φ(n) counts exactly how many integers from 1 to n are coprime to n.
Additional Resources
Reference this content, page, or tool as:
"Euler's Totient Function Calculator" at https://MiniWebtool.com/euler-s-totient-function-calculator/ from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Feb 17, 2026
Chat with your favorite AI
For Gemini, paste the copied question into the chat. You can also copy it below.
View the question
Advanced Math Operations:
- Adjacency Matrix Calculator New
- Antilog Calculator
- Beta Function Calculator
- Binomial Coefficient Calculator
- Binomial Probability Distribution Calculator
- Bitwise Calculator Popular
- Boolean Algebra Simplifier Popular
- Central Limit Theorem Calculator
- Chinese Remainder Theorem Calculator
- Combination Calculator
- Complementary Error Function Calculator
- Complex Number Calculator
- Continued Fraction Calculator
- Derangement (Subfactorial) Calculator
- Dijkstra's Shortest Path Calculator
- Entropy Calculator
- Error Function Calculator
- Euler's Totient Function Calculator
- Exponential Decay Calculator
- Exponential Growth Calculator
- Exponential Integral Calculator
- Exponents Calculator
- Extended Euclidean Algorithm Calculator
- Factorial Calculator
- Gamma Function Calculator
- Golden Ratio Calculator
- Graph Coloring Calculator New
- Graph Degree Sequence Validator
- Group Theory Order Calculator New
- Half Life Calculator
- Hamiltonian Path Checker New
- Inclusion-Exclusion Calculator New
- Karnaugh Map (K-Map) Solver New
- Linear Programming Solver New
- Markov Chain Steady State Calculator
- Minimum Spanning Tree Calculator
- Modular Exponentiation Calculator New
- Modular Multiplicative Inverse Calculator
- Negative Binomial Distribution Calculator New
- Network Flow Calculator (Max Flow) New
- Percent Growth Rate Calculator Popular
- Permutation Calculator
- Permutations with Repetition Calculator New
- Pigeonhole Principle Calculator
- Planar Graph Checker New
- Poisson Distribution Calculator
- Polynomial Roots Calculator
- Primitive Root Calculator
- Probability Calculator
- Probability Distribution Calculator
- Proportion Calculator
- Quadratic Formula Calculator
- Ring and Field Calculator New
- Rounding Calculator New
- Scientific Calculator
- Scientific Notation Calculator
- Set Theory Calculator
- Significant Figures Calculator New
- Stable Marriage Problem Solver New
- Stirling Numbers Calculator
- Sum of Cubes Calculator
- Sum of Positive Integers Calculator Popular
- Sum of Squares Calculator
- Topological Sort Calculator New
- Traveling Salesman Solver (TSP) New
- Truth Table Generator
- Venn Diagram Generator (3 Sets)