Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2018/ia/paper-4/7e/solution

Let , with . Then exactly when , and the sum becomes
This is when and otherwise. Summing over yields
Taking the complement of the case gives the inclusion-exclusion principle
If are the distinct prime divisors of , inclusion-exclusion removes their multiples from and gives
For the stated squarefree and , Fermat's theorem gives . Since , every divides ; their product does too. Thus is a Carmichael number.

New to topics? Read the docs here!