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

Solution 1:

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.