Maths & numbers

Euler totient calculator

Count integers coprime to n from 1 through n using its distinct prime factors.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your numbers and select Calculate.

Behind the numbers

How this calculation works

For each distinct prime divisor p, remove its multiples from the count through the product factor (1−1/p). A repeated prime contributes one such factor, not one for each copy.

THE FORMULAφ(n) = n × ∏(1−1/p), over distinct primes p dividing n

A worked example

36 = 2² × 3², so φ(36) = 36 × (1−1/2) × (1−1/3) = 12.

Good to know

n is a positive whole number up to one billion. By convention φ(1)=1. The result counts coprime integers, not prime numbers.

Count coprime values, not primes

Euler’s φ(n) counts the integers from 1 through n whose gcd with n is one. For n=36, the qualifying values include composites such as 25 and 35; the result 12 is not a count of primes below 36.

Factor 36 as 2²×3². Remove multiples of its distinct prime factors with 36(1−1/2)(1−1/3)=12. Repeating the factor for 2 because its exponent is two would incorrectly shrink the answer.

The prime factorization calculator exposes the distinct primes used by the totient product formula.

Use factorization to explain the product

The prime factorization and divisors calculator shows the prime powers feeding this formula. It answers divisor-count and divisor-sum questions separately. A gcd calculator checks coprimality for one candidate number instead of counting all candidates.

For a prime p, φ(p)=p−1 because every positive integer smaller than p is coprime to p. For n=1, the conventional value is φ(1)=1. Both are useful boundary checks.

Do not replace the group order with a guess

The multiplicative order calculator uses φ(m) as an upper bound on a coprime power cycle, then may reduce it. The order of one specific residue can be smaller than φ(m); the two quantities are not interchangeable.

This tool factors a positive integer only within its one-billion limit. It makes no claim about large-number factorization or cryptographic strength.

A few questions, answered

Does φ(36)=12 mean 12 divides 36?

It does here, but totient values need not generally divide their inputs.

Are repeated prime factors ignored?

Their presence determines n itself; only the product factor (1−1/p) is applied once for each distinct p.

Why is φ(1)=1?

One is coprime to itself under the usual gcd convention, and the standard arithmetic function uses this boundary value.

Find your calculator

Start typing to explore the library.