Euler's Totient Function φ(n)

Lesson · Intermediate

Number Theory

φ(n)=∣{1≤i≤n∣gcd⁡(i,n)=1}∣\varphi(n)=\left|\{1\le i\le n\mid \gcd(i,n)=1\}\right|

φ(n) is the number of integers from 1 to n that are relatively prime to n.

If

n=p1α1p2α2⋯pkαkn=p_1^{\alpha_1}p_2^{\alpha_2}\cdots p_k^{\alpha_k}
φ(n)=n(1−1p1)(1−1p2)⋯(1−1pk) \varphi(n) = n\left(1-\frac1{p_1}\right) \left(1-\frac1{p_2}\right) \cdots \left(1-\frac1{p_k}\right)