What is the sum of the squares of the differences of consecutive element of a Farey Sequence

Solution 1:

Actually, we can do it for higher powers as well. Let $F_k (N)$ denote the sum of the $k^{th}$ powers of the differences in the Farey sequence. Then it is easy to see that $$F_0(N)=\sum_{n=1}^N \phi(n)\sim \frac{3N^2}{\pi^2}$$ and $$F_1(N)=1.$$ It seems you are looking for $F_2 (N)$, and, you are correct that the asymptotic is $\frac{\log N}{N^2}$. More precisely we have: $$F_{2}(N)=\frac{12}{\pi^{2}N^{2}}\left(\log N+\frac{1}{2}+\gamma-\frac{\zeta'(2)}{\zeta(2)}\right)+O\left(\frac{\log^{2}N}{N^{3}}\right).$$

For $k\geq 3$, we the log disappears, and we have $$F_{k}(N)=\frac{2\zeta(k-1)}{\zeta(k)N^{k}}+O\left(\frac{\log N}{N^{k+1}}\right).$$ (The error can be improved by a log when $k\geq 4$)

Hope that helps,

References:

R.R. Hall's Paper: A Note on Farey Sequences.

Remark: I strongly suggest reading R.R. Hall's paper since it has the complete proofs, and covers other cases such as negative powers.