3 another typo corrected

Here's what you could do (I wrote it in haste so I am not responsible for mistakes). Consider a nice function $f$ with Mellin transform $$\hat{f}(s) = \int_{1}^{\infty} t^{s} f(t) \text{dt}$$ (most importantly we don't want our $\hat{f}$ to have poles and this is why I integrate from $1$ to $\infty$ rather than from $0$ to $\infty$). Now consider $$\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \zeta(s+1)^2 \hat{f}(s)\cdot\frac{\text{ds}}{s}$$ (with $c > 0$). On the one hand expanding $\zeta(s+1)^2$ into a Dirichlet series and $\hat{f}$ into an integral and interchanging both sum and integrals, we obtain that the integral above is equal to $$\sum_{n \geq 1} \frac{d(n)^2}{n} frac{d(n)}{n} \int_{1}^{\infty} f(t) \frac{1}{2\pi i} \int_{c - i\infty}^{c + i\infty} \frac{t^s}{n^s} \frac{1}{s}\text{ds} \text{dt} = \sum_{n \geq 1} \frac{d(n)^2}{n} frac{d(n)}{n} \int_{n}^{\infty} f(t) \text{dt}$$ (The interchange might be difficult and I describe a way around it, below). On the other hand we can estimate the integral appearing in the second formula in this post, by shifting the contour and picking up residues. For instance, the residue at $s = 0$ gives $$\int_{1}^{\infty} (\frac{\log(t)^2}{2} + 2\log(t) + 2\gamma) f(t) \text{dt}$$ [Warning: I might have messed up the residue calculation] and this is the "expected main term" (if not an exact expression!) for the integral in the second formula. Thus for example when $f(t) = e^{-\epsilon t}$ you expect the third formula to be asymptotic to the fourth formula (as $\epsilon$ goes to zero) [actually in this case, the two are probably identically equal].

The important feature of $f(t) = e^{-\epsilon t}$ is that $\hat{f}(s)$ has no poles!. The method described here, should work equally well for any nice smooth function which is not too different from $e^{-\epsilon t}$.

Also, note that instead of using $\frac{1}{s}$ in the second formula, you could use $\Gamma(s)$. That would lead to a messier formula (you would need to take into account the poles of $\Gamma(s)$ at -1,-2,...) - but interchanging sum and integral in the third formula would be much much easier.

2 added 67 characters in body

Here's what you could do (I wrote it in haste so I am not responsible for mistakes). Consider a nice function $f$ with Mellin transform $$\hat{f}(s) = \int_{1}^{\infty} t^{s} f(t) \text{dt}$$ (most importantly we don't want our $\hat{f}$ to have poles and this is why I integrate from $1$ to $\infty$ rather than from $0$ to $\infty$). Now consider $$\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \zeta(s+1)^2 \hat{f}(s)\cdot\frac{\text{ds}}{s}$$ (with $c > 0$). On the one hand expanding $\zeta(s+1)^2$ into a Dirichlet series and $\hat{f}$ into an integral and interchanging both sum and integrals, we obtain that the integral above is equal to $$\sum_{n \geq 1} \frac{d(n)^2}{n} \int_{1}^{\infty} f(t) \frac{1}{2\pi i} \int_{c - i\infty}^{c + i\infty} \frac{t^s}{n^s} \frac{1}{s}\text{ds} \text{dt} = \sum_{n \geq 1} \frac{d(n)^2}{n} \int_{n}^{\infty} f(t) \text{dt}$$ (The interchange might be difficult and I describe a way around it, below). On the other hand we can estimate the integral appearing in the second formula in this post, by shifting the contour and picking up residues. For instance, the residue at $s = 0$ gives $$\int_{1}^{\infty} (\log(t)^2 \frac{\log(t)^2}{2} + 2\log(t) + 2\gamma) f(t) \text{dt}$$, text{dt}$$[Warning: I might have messed up the residue calculation] and this is the "expected main term" (if not an exact expression!) for the integral in the second formula. Thus for example when f(t) = e^{-\epsilon t} you expect the third formula to be asymptotic to the fourth formula (as \epsilon goes to zero) [actually in this case, the two are probably identically equal]. The important feature of f(t) = e^{-\epsilon t} is that \hat{f}(s) has no poles!. The method described here, should work equally well for any nice smooth function which is not too different from e^{-\epsilon t}. Also, note that instead of using \frac{1}{s} in the second formula, you could use \Gamma(s). That would lead to a messier formula (you would need to take into account the poles of \Gamma(s) at -1,-2,...) - but interchanging sum and integral in the third formula would be much much easier. 1 Here's what you could do (I wrote it in haste so I am not responsible for mistakes). Consider a nice function f with Mellin transform$$\hat{f}(s) = \int_{1}^{\infty} t^{s} f(t) \text{dt}$$(most importantly we don't want our \hat{f} to have poles and this is why I integrate from 1 to \infty rather than from 0 to \infty). Now consider$$\frac{1}{2\pi i}\int_{c-i\infty}^{c+i\infty} \zeta(s+1)^2 \hat{f}(s)\cdot\frac{\text{ds}}{s}$$(with c > 0). On the one hand expanding \zeta(s+1)^2 into a Dirichlet series and \hat{f} into an integral and interchanging both sum and integrals, we obtain that the integral above is equal to$$\sum_{n \geq 1} \frac{d(n)^2}{n} \int_{1}^{\infty} f(t) \frac{1}{2\pi i} \int_{c - i\infty}^{c + i\infty} \frac{t^s}{n^s} \frac{1}{s}\text{ds} \text{dt} = \sum_{n \geq 1} \frac{d(n)^2}{n} \int_{n}^{\infty} f(t) \text{dt}$$(The interchange might be difficult and I describe a way around it, below). On the other hand we can estimate the integral appearing in the second formula in this post, by shifting the contour and picking up residues. For instance, the residue at s = 0 gives$$\int_{1}^{\infty} (\log(t)^2 + 2\log(t) + 2\gamma) f(t) \text{dt}, and this is the "expected main term" (if not an exact expression!) for the integral in the second formula. Thus for example when $f(t) = e^{-\epsilon t}$ you expect the third formula to be asymptotic to the fourth formula (as $\epsilon$ goes to zero) [actually in this case, the two are probably identically equal].

The important feature of $f(t) = e^{-\epsilon t}$ is that $\hat{f}(s)$ has no poles!. The method described here, should work equally well for any nice smooth function which is not too different from $e^{-\epsilon t}$.

Also, note that instead of using $\frac{1}{s}$ in the second formula, you could use $\Gamma(s)$. That would lead to a messier formula (you would need to take into account the poles of $\Gamma(s)$ at -1,-2,...) - but interchanging sum and integral in the third formula would be much much easier.