# 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.

-
The numerical evidence is unambiguously in your favour; $$\frac1n\sum_{k=1}^n\varrho(k)-\frac6{\pi^2}\log n$$ fluctuates near $0.0895$, which coincides up to three significant digits with your constant. – joriki Oct 30 '12 at 23:12
I accidentally let the calculation continue in the background :-) It came up to $n=733184$ and seemed to be hovering around $0.089478\pm0.000005$, in agreement with your constant $0.894727\dots$ – joriki Oct 31 '12 at 6:12
I tried to duplicate Eric's calculation and am very certain that you are correct. I guess that Eric accidentally wrote $\sum \frac{\mu(n)}{n^s} = \zeta(s)$ when he tried to evaluate $\sum \frac{\mu(n) \log(n)}{n^s}$, which causes the error. – user27126 Nov 6 '12 at 1:11

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}.$$