this is the second exercise of chapter 3:
if $x\ge 2$ prove that
$$\sum_{n\le x} \frac{d(n)}{n}= \frac{1}{2} {\log^2 x} + 2C\log x +O(1)$$ where $C$ is Euler's constant.
here's what i've done to solve:
as we know that $\sum_{n\le x} {d(n)}= \sum_{d\le x} \sum_{q\le\frac{x}{d}} 1$ so we have:
$$\sum_{n\le x} \frac{d(n)}{n}= \sum_{d\le x} \frac{1}{d} \sum_{q\le\frac{x}{d}} \frac{1}{q}$$ (because $qd=n$)
as we learn from this chapter we have:
$$\sum_{q\le\frac{x}{d}} \frac{1}{q} = \log \frac{x}{d} + C + O(\frac{d}{x})$$
so $$\sum_{n\le x} \frac{d(n)}{n}= \log x (\log x + C+O(\frac{1}{x})) - \sum_{d\le x} \frac{\log d}{d} + C\log x + C^2 + C O(\frac{1}{x}) + \sum_{d\le x} \frac{1}{d} O(\frac {d}{x}) $$
we have: $$\sum_{d\le x} \frac{1}{d} O(\frac {d}{x}) = O(1) $$
and by Euler summation formula :
$$ \begin{align} \sum_{d\le x} \frac{\log d}{d} & = \int_1^x \frac{\log t}{t} dt + \int_1^x \frac{(t-[t])(1-\log t)}{t^2} dt + \frac{\log x}{x}[x]- \log x \\ & = \frac {1}{2}\log^2 x + O(\frac{\log x }{x}) + \frac{\log x}{x}[x]- \log x = \frac {1}{2}\log^2 x + O(\frac{\log x }{x}) \end{align} $$
(because $[x]=x + o(1)$ we have: $\frac{\log x}{x}[x]- \log x = O(\frac{\log x}{x}) $
and for $$\int^x_1 \frac{(t-[t])(1-\log t)} {t^2} dt$$ we notice:
$$|\int^x_1 \frac{(t-[t])(1-\log t)} {t^2}dt| < |\int^x_1 \frac{(1-\log t)} {t^2}dt|$$
and
$$\int^x_1 \frac{(1-\log t)} {t^2}dt =\frac{\log x }{x}$$
so $\displaystyle\int^x_1 \frac{(t-[t])(1-\log t)} {t^2}dt = O(\frac{\log x}{x})$)
all the results gives us : $$\sum_{n\le x} \frac{d(n)}{n}= \frac{1}{2} {\log^2 x} + 2C\log x + O(\frac{\log x}{x})$$
what is my mistake?
thank you very much.
I have not dug into the details but your error term is too small, it is not possibile to have something better than $O(1)$, since, by exploiting the Dirichlet hyperbola method, that leads to: $$\sum_{n\leq x}d(n) = x\log x + (2\gamma-1)x + O(\sqrt{x}),\tag{1}$$ it follows that: $$\begin{eqnarray*}\sum_{n\leq x}\frac{d(n)}{n}&=&\log x+(2\gamma-1)+O\left(\frac{1}{\sqrt{x}}\right)+\int_{1}^{x}\left(\frac{\log t+(2\gamma-1)}{t}\right)\,dx\\&=&\frac{1}{2}\log^2 x+2\gamma\log x+(2\gamma-1)+O\left(\frac{1}{\sqrt{x}}\right)\tag{2} \end{eqnarray*}$$ through Abel's summation formula.