Maths WorkshopMaths problems with full solutions
Exercise 1836Number theory › PrimesL1Added 3 Nov 2026

GCD via Euler's totient

#gcd#Euler totient#formula

Statement

Show that ∑d∣nφ(d)=n\sum_{d\mid n}\varphi(d)=n for all n≥1n\ge1.

Hint

Partition {1,…,n}\{1,\ldots,n\} by gcd⁡(k,n)\gcd(k,n).

Show solutionHide solution

Solution

Partition. For each divisor d∣nd\mid n, let Sd={k∈{1,…,n}:gcd⁡(k,n)=d}S_d=\{k\in\{1,\ldots,n\}:\gcd(k,n)=d\}.

Size. k∈Sdk\in S_d iff k=dmk=dm with 1≤m≤n/d1\le m\le n/d and gcd⁡(m,n/d)=1\gcd(m,n/d)=1. So ∣Sd∣=φ(n/d)|S_d|=\varphi(n/d).

Sum. The sets SdS_d partition {1,…,n}\{1,\ldots,n\}, so ∑d∣nφ(n/d)=n\sum_{d\mid n}\varphi(n/d)=n, i.e. ∑d∣nφ(d)=n\sum_{d\mid n}\varphi(d)=n.

Conclusion. The identity holds.

Example. n=6n=6: φ(1)+φ(2)+φ(3)+φ(6)=1+1+2+2=6\varphi(1)+\varphi(2)+\varphi(3)+\varphi(6)=1+1+2+2=6. ✓