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.
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{\log x}{\sqrt{x}}\right).$$