Problem

Source: 2010 HongKong mathematic Olympiad

Tags: modular arithmetic, floor function, number theory proposed, number theory



Let $n$ be a positive integer. Let $a$ be an integer such that $\gcd (a,n)=1$. Prove that \[\frac{a^{\phi (n)}-1}{n}=\sum_{i\in R}\frac{1}{ai}\left[\frac{ai}{n}\right]\pmod{n}\] where $R$ is the reduced residue system of $n$ with each element a positive integer at most $n$.