Euler Totient Calculator

Compute Euler's φ(n).

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Enter n to count how many integers from 1 to n share no factor with it. φ(12) = 4, namely 1, 5, 7 and 11.

How to use

1
Step 1
Enter a positive whole number n.
2
Step 2
Press Calculate.
3
Step 3
Read φ(n), the count of numbers up to n that are coprime to it.

How it works

φ is computed from the prime factors of n: for each distinct prime p, multiply by (1 − 1/p). For 100 = 2² × 5², that is 100 × ½ × ⅘ = 40. A prime p always gives p − 1. RSA uses φ(n) = (p − 1)(q − 1).

φ(n) = n × Π (1 − 1/p) over the distinct primes p dividing n

Worked example

Totient of 100

Input
n = 100
Output
40
Walkthrough
The prime factors of 100 are 2 and 5. 100 × (1 − 1/2) × (1 − 1/5) = 100 × 0.5 × 0.8 = 40.

Limitations

  • n must be a positive whole number; 0 is rejected.
  • Speed depends on factoring n, which is instant for numbers up to about 10¹².

Questions

What is φ(12)?
φ(12) = 4, because 1, 5, 7 and 11 are the numbers up to 12 that are coprime to 12.
What is φ(100)?
40.
What is φ of a prime like 97?
96, because every smaller number is coprime to it.
What is φ(1,000,000,000,000)?
400,000,000,000.

Features

  • Prime-factor method
  • Large inputs
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Scientific notation examples

    Khan Academy

    Worked examples to compare with calculator output.

    Watch on YouTube
  • Vectors | Essence of linear algebra

    3Blue1Brown

    Linear algebra intuition for matrix and vector tools.

    Watch on YouTube
  • Pi

    Math is Fun

    What π means when calculators return pi-based results.

  • Pre-algebra

    Khan Academy

    Number sense practice that supports general calculator use.