Euler’s Totient Function Calculator

Calculate Euler’s φ(n), the count of numbers up to n that are coprime to n, with the product formula worked out. φ(n) = n × ∏ (1 − 1/p), the product running over the distinct primes p dividing n. Example: with number n 36, the result is φ(36) = 12.

Last updated · By · Runs in your browser, nothing is uploaded

Result

Step-by-Step Solution

Enter your values above to see the full working.

How do you use the Euler’s Totient Function Calculator?

Enter a whole number n. The calculator factors it, applies Euler’s product formula and reports φ(n), the count of integers from 1 to n that share no common factor with n, along with the percentage and the factorization.

What formula does the Euler’s Totient Function Calculator use?

φ(n) = n × ∏ (1 − 1/p), the product running over the distinct primes p dividing n. For a prime p, φ(p) = p − 1; for a prime power, φ(p^k) = p^k − p^(k−1); and φ is multiplicative: φ(ab) = φ(a)φ(b) when GCD(a, b) = 1.

Worked example: Number n 36

For n = 36 = 2² × 3², φ(36) = 36 × (1 − 1/2) × (1 − 1/3) = 36 × 1/2 × 2/3 = 12. The twelve numbers coprime to 36 are 1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31 and 35.

With the default values the calculator returns φ(36) = 12; Prime factors = 2^2 × 3^2; Numbers from 1 to n not coprime to n = 24; Share of numbers coprime to n = 33.3333%.

Where Is This Calculation Used?

The totient is central to RSA cryptography: Euler’s theorem says a^φ(n) ≡ 1 (mod n) when a and n are coprime, which lets you compute decryption exponents. It also counts the reduced fractions with denominator n and the primitive roots of unity.

What are the most common mistakes with the Euler’s Totient Function Calculator?

  • Using all prime factors with multiplicity instead of the distinct primes.
  • Forgetting φ(1) = 1.
  • Applying multiplicativity when the factors are not coprime.

What Is the Tested Example for the Default Values?

This example is computed by the same code that powers the calculator above, so you can compare it with your own numbers or a textbook answer.

Input: Number n36
φ(36)12
Prime factors2^2 × 3^2
Numbers from 1 to n not coprime to n24
Share of numbers coprime to n33.3333%
Is n prime?No

Where Can You Verify These Formulas?

The definitions and formulas on this page follow standard references. Check them against these sources:

Built and maintained by S. Dilshan. Found a mistake? Email [email protected] with the page address.

Frequently Asked Questions

What is Euler’s totient function?

φ(n) counts the integers from 1 to n that are coprime to n, meaning they share no factor with it other than 1.

What is φ of a prime number?

For a prime p, every smaller positive integer is coprime to it, so φ(p) = p − 1.

Why is the totient used in RSA?

RSA relies on Euler’s theorem: a^φ(n) ≡ 1 (mod n). With n = pq, φ(n) = (p − 1)(q − 1), which gives the private exponent.