average order of $\sum\limits_{\substack{1\le k\le n \\ (k,n)=1}} \frac{1}{k}$ Introduce $$\varrho(n) = \sum\limits_{\substack{1\le k\le n \\ (k,n)=1}} \frac{1}{k}.$$ The following thread at math.stackexchange.com proposes to analyse the average order of $\varrho(n)$, i.e. $$\frac{1}{n} \sum_{k=1}^n \varrho(k).$$
I have tried to duplicate this calculation but I don't arrive at the same result. My question is, which one is right, the original post or my findings. My calculation follows.
First we need an identity for $\varrho$ that will prove very useful later on.
Observe that
$$ \varrho(n) + \sum_{\substack{d\mid n \\ d>1}} 
\sum^n_{\substack{k=1 \\ (k, n)=d}} \frac{1}{k} = H_n.$$
Now the LHS is
$$ \varrho(n) + \sum_{\substack{d\mid n \\ d>1}} 
\sum^{n/d}_{\substack{m=1 \\ (m, n/d)=1}} \frac{1}{md} =
\varrho(n) + \sum_{\substack{d\mid n \\ d>1}} \frac{1}{d}
\varrho\left(\frac{n}{d}\right) =
\sum_{d\mid n} \frac{1}{d}
\varrho\left(\frac{n}{d}\right).$$
Switching to Dirichlet convolutions, we have
$$\varrho \star \frac{1}{n} = H_n
\sim \log n + \gamma + \frac{1}{2n}.$$
With $$ A(s) = \sum_{n\ge 1}\frac{\varrho(n)}{n^s}$$ this gives
$$ A(s) \zeta(s+1) \sim -\zeta'(s) + \gamma \zeta(s) + \frac{1}{2} \zeta(s+1)$$
or
$$ A(s) \sim \frac{1}{\zeta(s+1)}
\left( -\zeta'(s) + \gamma \zeta(s) \right) + \frac{1}{2}.$$
To find the average order use the Mellin-Perron type integral
$$\int_{3/2-i\infty}^{3/2+i\infty} A(s) n^s \frac{ds}{s}
=  -\frac{1}{2} \varrho(n) + \sum_{k=1}^n \varrho(k)$$ and shift to the left to pick up the residue at $s=1$, getting
$$ \frac{6}{\pi^2} n \log n + 
\left(\frac{6(\gamma-1)}{\pi^2} - \frac{36}{\pi^4} \zeta'(2)\right) n
+ O(\log n)$$
so that the average order is
$$ \frac{1}{n} \sum_{k=1}^n \varrho(k) \sim
\frac{6}{\pi^2} \log n + 
\left(\frac{6(\gamma-1)}{\pi^2} - \frac{36}{\pi^4} \zeta'(2)\right)
+ O\left(\frac{\log n}{n}\right).$$
Which one is right?
Addendum. In view of Eric Naslunds excellent comment below 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.
 A: Your calculation is correct.  When I reached the sum $$\sum_{n=1}^\infty \frac{\mu(n)\log n}{n^2}$$ I incorrectly wrote that it equals $-\zeta^{'}(2)$, rather than $\frac{\zeta^{'}(2)}{\zeta(2)^2}$.  To see why it is $\frac{\zeta^{'}(2)}{\zeta(2)^2}$,simply take the derivative of $$\frac{1}{\zeta(s)}=\sum_{n=1}^\infty \mu(n)n^{-s}.$$
Remark: I note again that your proof is missing most of the critical details.  When using the residue theorem to evaluate the sum of a multiplicative function, the majority of the work appears when bounding the other three parts of the contour, something which you have taken for granted.  Evaluating the residue is the easiest part, and only a minor detail.  You must prove that this is actually the asymptotic.  This is why I shied away from the residue theorem in my other answers.  It provides a nice and fast heuristic, allowing us to see what the answer should be, but to actually prove the results and find the correct error term requires bounds on zeta and lemmas I didn't want to use.  It is not always trivial to guess the correct error term when using residue methods.
