Euler's Totient Calculator

Find Euler's totient of any positive integer.

Result

12
12

How it is calculated

Euler's totient φ(n) counts the integers from 1 to n that have no common factor with n other than 1. The tool does not test each number. It factors n and applies the product formula φ(n) = n × ∏(1 − 1/p) over each distinct prime p dividing n, using only whole-number steps. For a prime p, φ(p) = p − 1. The input is cut to a whole number and must be between 1 and 1,000,000,000. Both result fields show the same count.

Worked example

Take n = 36. Its prime factors are 2 and 3, since 36 = 2² × 3². Start with 36. For the prime 2, subtract 36 / 2 = 18, leaving 18. For the prime 3, subtract 18 / 3 = 6, leaving 12. So φ(36) = 12: the numbers 1, 5, 7, 11, 13, 17, 19, 23, 25, 29, 31 and 35 share no factor with 36.

Try this example →

Common mistakes

  • Counting each prime factor with its multiplicity. 36 = 2 × 2 × 3 × 3 uses only the distinct primes 2 and 3 in the formula.
  • Assuming φ(n) = n − 1 for every n. That holds only for primes; for 36 it is 12, not 35.
  • Multiplying φ values for numbers that share factors. φ(a × b) = φ(a) × φ(b) only works when a and b are coprime.
  • Entering a decimal or a number above one billion. A decimal is cut to a whole number and a larger value returns nothing.

About this calculator

This calculator finds Euler's totient φ(n) — the count of positive integers from 1 to n that are coprime with n (share no common factor with n other than 1). It's computed from n's prime factorization using the product formula φ(n) = n·∏(1 − 1/p) over each distinct prime factor p of n; for a prime p itself, φ(p) = p − 1.

The totient function is central to number theory and is the mathematical foundation of the RSA public-key cryptosystem, where φ(n) (computed from two large secret primes) is used to derive the private key from the public key. It also governs Euler's theorem, a generalization of Fermat's little theorem used throughout modular arithmetic.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    For a modulus built from two distinct primes, n = p × q, the totient must equal (p − 1)(q − 1), which gives you a hand check: 77 = 7 × 11 should return 6 × 10 = 60. Keep in mind that this tool stops at one billion, far below the size of real RSA moduli, so it suits learning and homework rather than key generation. Working on a modular-arithmetic exercise? Post the n you are stuck on and the value you expected.

Popular calculators

All Calculators