# the constant in the asymptotics of $\sum_{1\le k \le n} \frac{\varphi(k)}{k^2}$

The following thread at math.stackexchange.com proposes a constant term for the asymptotic expansion of $$\sum_{1\le k \le n} \frac{\varphi(k)}{k^2}.$$

I am getting a different term and I would like to know which is right.

My calculation goes like this: first recall the classic identity $$\sum_{d\mid n} \varphi(d) = n,$$ which gives the Dirichlet convolution $$\varphi \star 1 = n \quad \text{and hence} \quad \sum_{n\ge 1} \frac{\varphi(n)}{n^s} = \frac{\zeta(s-1)}{\zeta(s)}.$$ To evaluate the sum use the Mellin-Perron type integral $$\int_{2-i\infty}^{2+i\infty} A(s) n^s \frac{ds}{s} = -\frac{1}{2}\frac{\varphi(n)}{n^2} + \sum_{k=1}^n \frac{\varphi(k)}{k^2} \quad \text{where} \quad A(s) = \frac{\zeta(s+1)}{\zeta(s+2)}.$$ and shift to the left to pick up the residue at $s=0$, getting $$\frac{6}{\pi^2} \log n + \left(\frac{6\gamma}{\pi^2} - \frac{36}{\pi^4} \zeta'(2)\right) + O\left( \frac{\log n}{n} \right).$$

Addendum. In view of Eric Naslunds excellent comment below (the second one to point out the missing details) maybe we can ask whether anyone is able to supply those missing bounds on the rest of the contour for the Mellin-Perron integral, thereby turning this question into a useful reference. Here is a MSE challenge of the same type.

-
Again the numerical evidence is on your side. The sum up to $n=10000$ is $6.296626...$ according to Wolfram|Alpha, and subtracting the logarithmic part leaves $0.697411...$, in good agreement with your constant $0.697400...$. – joriki Nov 6 '12 at 1:53

Your calculation is correct. The hyperbola method also yields $$\sum_{n\leq x}\frac{\phi(n)}{n^2}=\frac{\log x}{\zeta(2)}+\frac{\gamma}{\zeta(2)} -\frac{\zeta^{'}(2)}{\zeta(2)^2}+O\left(\frac{\log x}{x}\right).$$

My previous answer contained a small error, and has been updated. I should have expanded $\log \left(\frac{x}{d}\right)$ as $\log x-\log d$, but I forgot the $\log d$ and wrote only $\log x$, and consequently there was no $\zeta^{'}(2)$ term.

Additional Remarks: Be cautious when using contour integration if you are trying to prove a better error term. The residue will always give you the main term almost instantly, but for the error term, you need to use Lemmas regarding bounds on the size of $\zeta(s)$ as we $t$ goes to infinity so that you can show that each part of the contour goes to zero. Do not assume that they must go to zero, since often this is simply false.

An excellent example is the average of $\frac{\phi(n)}{n}$, that is the sum $\sum_{n\leq x} \frac{\phi(n)}{n}$. One can show that $$\sum_{n\leq x} \frac{\phi(n)}{n}=\frac{6}{\pi^2}x+O(\log x)$$ by either elementary methods or contour integration, but we can ask how much better should the error term be. If you are not extremely careful with the bounds on zeta, then you might convince yourself that one can get the error term $O(e^{-c\sqrt{\log x}})$. However, this is provably false.

-
Thanks for your useful and kind commentary. I am actually aware of the difficulty of estimating the remainder terms in these types of calculations and I have seen cases where the intervening integrals do not go to zero. I have a question for you however: in your calculation of the order of $\sum_{n<=x} n/\varphi(n)$ you produce the constant $\zeta(2)\zeta(3)/\zeta(6)$ as if by magic or through an inverter. How did you get it? Do you have a closed form of the Dirichlet series $\sum n/\varphi(n)$ or $\sum \frac{\mu(n)^2}{n\varphi(n)}$? I wasn't able to duplicate your construction. – Marko Riedel Nov 9 '12 at 22:09
The stackexchange software wouldn't let me fix my previous edit. Of course I mean $\sum_n \frac{n/\varphi(n)}{n^s}$ and $\sum_n \frac{\mu(n)^2/n/\varphi(n)}{n^s}$. – Marko Riedel Nov 9 '12 at 22:18
@MarkoRiedel Let me add some more explanation. We are looking at the infinite series $$\sum_{d=1}^{\infty}\frac{\mu(d)^{2}}{d\phi(d)}.$$ Since the summand is a multiplicative function, and since everything converges nicely, we can write this as an Euler product $$\sum_{d=1}^{\infty}\frac{\mu(d)^{2}}{d\phi(d)}=\prod_{p}\left(1+\frac{\mu(p)^{‌​2}}{p\phi(p)}+\frac{\mu(p^{2})^{2}}{p^{2}\phi(p^{2})}+\cdots\right).$$ This equals $$\prod_{p}\left(1+\frac{1}{p\left(p-1\right)}\right)=\prod_{p}\left(\frac{p^{2}‌​-p+1}{p\left(p-1\right)}\right).$$ – Eric Naslund Nov 10 '12 at 2:10
Here is the tricky part: Recalling the factorization $p^{3}+1=\left(p^{2}-p+1\right)\left(p+1\right),$ we multiply to and bottom by $p+1$. This will give $p^3+1$ on top, but since we want $\zeta(s)$ we also multiply top and bottom by $p^{3}-1$, and we get $$\prod_{p}\left(\frac{p^{3}+1}{p(p^{2}-1)}\cdot\frac{p^{3}-1}{p^{3}-1}\right)$$ $$=\prod_{p} \left(1-\frac{1}{p^{6}}\right)\left(1-\frac{1}{p^{3}}\right)^{-1}\left(1-\frac{1‌​}{p^{2}}\right)^{-1},$$ which equals $\frac{\zeta(2)\zeta(3)}{\zeta(6)}.$ – Eric Naslund Nov 10 '12 at 2:12
Thanks, very nice ... could have done it myself but I was trying to evaluate the Dirichlet series for all s > some $s_0$, instead of at one point (s=2). How embarassing. – Marko Riedel Nov 10 '12 at 2:34