The asymptotic expansion for the weighted sum of divisors $\sum_{n\leq x} \frac{d(n)}{n}$

I am trying to solve a problem about the divisor function. Let us call $d(n)$ the classical divisor function, i.e. $d(n)=\sum_{d|n}$ is the number of divisors of the integer $n$. It is well known that the sum of $d(n)$ over all positive integers from $n=1$ to $x$, when $x$ tends to infinity, is asymptotic to $$x \ln(x) + (2 \gamma-1) x + O(\sqrt{x})$$

I would like to calculate a similar asymptotic expression for the sum of $d(n)/n$, again calculated from $n=1$ to $x$ and for $x$ that tends to infinity. I have made some calculations and obtained the formula $$1/2 (\ln(x))^2 + 2 \gamma \ln (x) + O(1)$$ where gamma is the Euler-Mascheroni constant. I am interested in the constant term of the expression, which seems to be around $0.48$. I suspect that it could correspond to $\gamma^2 - 2\gamma_1$, where $\gamma_1$ is the first Stieltjes constant ($-0.072...$). Could someone confirm this to me?

As an additional question, I would be very interested in obtaining similar asymptotic formulas, with explicitly given constant terms, for the same sum of $d(n)/n$ calculated over all odd integers from $1$ to $x$, and for that calculated over all even integers from $1$ to $x$. Many thanks.


Solution 1:

The asymptotic can be found using the hyperbola method. Notice that $$\sum_{n\leq x}\frac{d(n)}{n}=\sum_{n\leq x}\frac{1}{n} \sum_{ab=n}1=\sum_{ab\leq x}\frac{1}{ab}.$$ Rearranging based on the geometry of the hyperbola, this equals $$2\sum_{a\leq\sqrt{x}}\frac{1}{a}\sum_{b\leq\frac{x}{a}}\frac{1}{b}-\sum_{a\leq\sqrt{x}}\sum_{b\leq\sqrt{x}}\frac{1}{ab}.$$ Since $\sum_{b\leq\frac{x}{a}}\frac{1}{b}=\log\frac{x}{a}+\gamma+O\left(\frac{a}{x}\right),$ it follows that $$2\sum_{a\leq\sqrt{x}}\frac{1}{a}\sum_{b\leq\frac{x}{a}}\frac{1}{b}=2\sum_{a\leq\sqrt{x}}\frac{1}{a}\log\left(\frac{x}{a}\right)+2\gamma\sum_{a\leq\sqrt{x}}\frac{1}{a}+O\left(\frac{1}{x}\sum_{a\leq\sqrt{x}}1\right),$$ so we have that $$\sum_{n\leq x}\frac{d(n)}{n}=2\log x\sum_{a\leq\sqrt{x}}\frac{1}{a}-2\sum_{a\leq\sqrt{x}}\frac{\log a}{a}+2\gamma\left(\log\sqrt{x}+\gamma\right)-\left(\log\sqrt{x}+\gamma+O\left(\frac{1}{x}\right)\right)^{2}+O\left(\frac{1}{\sqrt{x}}\right)$$

$$=\frac{3}{4}\log^{2}x+2\gamma\log x-2\sum_{a\leq\sqrt{x}}\frac{\log a}{a}+\gamma^{2}+O\left(\frac{1}{\sqrt{x}}\right).$$ By definition of the Stieltjies constants, $$\sum_{a\leq z}\frac{\log a}{a}=\frac{\log^{2}z}{2}+\gamma_{1}+O\left(\frac{\log z}{z}\right),$$ so we obtain the asymptotic result $$\sum_{n\leq x}\frac{d(n)}{n}=\frac{1}{2}\log^{2}x+2\gamma\log x+\gamma^{2}-2\gamma_{1}+O\left(\frac{1}{\sqrt{x}}\right).$$

Solution 2:

I can confirm Eric Naslund's excellent work using a different method, namely the following version of the Mellin-Perron summation formula:

$$\sum_{k=1}^{n-1} \sum_{m=1}^k \lambda_m = \frac{n}{2\pi i} \int_{c-i\infty}^{c+i\infty} \Lambda(s) n^s \frac{ds}{s(s+1)}$$ where $$\Lambda(s) = \sum_{k\ge 1}\frac{\lambda_k}{k^s}.$$ This will produce an asymptotic expansion of $q(n-1)$ where $$q(n-1) = \sum_{k=1}^{n-1} \sum_{m=1}^k \frac{d(m)}{m}$$ so that $q(n)-q(n-1)$ is the asymptotic expansion we are looking for. The reason we do it this way is because the quotient by $s(s+1)$ ensures absolute convergence of certain integrals that appear later on, where a quotient of $s$ alone would not suffice.

The Dirichlet series in question is $$ \Lambda(s) = \sum_{n\ge 1} \frac{d(n)/n}{n^s} = \zeta(s+1)^2$$ so that $$ q(n-1) = \frac{n}{2\pi i} \int_{1/2-i\infty}^{1/2+i\infty} \zeta(s+1)^2 n^s \frac{ds}{s(s+1)}.$$ Now we have $$\operatorname{Res}\left(\zeta(s+1)^2 \frac{n^s}{s(s+1)}; s=0\right) = \frac{1}{2} \log^2 n + (2\gamma-1)\log n + (\gamma-1)^2 - 2\gamma_1.$$ We pick up this residue when we shift the integral to the line $\Re(s) = -1/2.$ This almost concludes the computation, we only need to estimate the remainder term which is done as follows. First write $$ \frac{1}{2\pi i} \int_{-1/2-i\infty}^{-1/2+i\infty} \zeta(s+1)^2 n^s \frac{ds}{s(s+1)} = \frac{1}{\sqrt{n}}\frac{1}{2\pi} \int_{-\infty}^{\infty} \zeta(1/2+it)^2 \frac{e^{it\log n}}{(-1/2+it)(1/2+it)} dt.$$ Now $1/2+it$ is on the critical line so using an early version of Lindelöf we have that $$|\zeta(1/2+it)|^2 \frac{1}{|-1/2+it|\times|1/2+it|} \in \mathcal{O}(|t|^{1/4\times 2-2}) = \mathcal{O}(|t|^{-3/2}).$$

and hence the integral converges absolutely. This shows that the remainder term from Mellin-Perron integral is $$\mathcal{O}\left(\frac{1}{\sqrt{n}}\right)$$ Hence the final asymptotic expansion is in fact $$q(n)-q(n-1) \sim (n+1) \left(\frac{1}{2} \log^2 (n+1) + (2\gamma-1)\log (n+1) + (\gamma-1)^2 - 2\gamma_1 + \mathcal{O}\left(\frac{1}{\sqrt{n+1}}\right)\right) \\ - n \left(\frac{1}{2} \log^2 n + (2\gamma-1)\log n + (\gamma-1)^2 - 2\gamma_1 + \mathcal{O}\left(\frac{1}{\sqrt{n}}\right)\right)$$ which gives $$\frac{1}{2} ((n+1)\log^2 (n+1) - n \log^2 n) + (2\gamma-1) ((n+1)\log (n+1) - n\log n) \\+ (\gamma-1)^2 - 2\gamma_1 + \mathcal{O}\left(\sqrt{n+1}-\sqrt{n}\right).$$ Now expanding the asymptotics e.g. as in $$(n+1)\log(n+1)-n\log n = \log(n+1) + n \log(1+1/n) = \log n + (n+1)\log(1+1/n)$$ and in $\sqrt{n+1}-\sqrt{n} \sim \frac{1}{2\sqrt{n}}$ we see that the asymptotic expansion is indeed $$\frac{1}{2} \log^2 n + 2\gamma\log n + \gamma^2 - 2\gamma_1 + \mathcal{O}\left(\frac{1}{\sqrt{n}}\right).$$

Remark. I can probably do the sum for the odd integers restriction if anyone is interested.