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.