-1

Find the value of this series:

$$\sum_{i=1}^n \frac{n}{\text{gcd}(i,n)}.$$

jimjim
  • 9,855

1 Answers1

3

For each divisor $d$ of $n$ there are exactly $\phi\left(\frac nd\right)$ terms in the sum whose value is $\frac nd$, so

$$\sum_{j=1}^n\frac n{(j,n)}=\sum_{d\mid n}\frac nd\phi\left(\frac nd\right)=\sum_{d\mid n}d\phi(d)=\sum_{d\mid n}\phi(d^2)$$

ajotatxe
  • 66,849
  • Could you explain (or provide some reference) why there are exactly $\phi(n/d)$ terms in the sum with value $n/d$? – A.P. Nov 10 '15 at 16:07
  • I think I got it. If the term for $1 \leq i \leq n$ has value $n/d$, then $\gcd(i, n) = d$. On the other hand, this happens iff $\gcd(i, n/d) = n/d$. Is this correct? – A.P. Nov 10 '15 at 16:17