Compute $\int_0^n \left[\frac x {x+1} + \frac x {2x+4} + \frac x {3x+9} + \cdots\right] \, dx$ for $x>0$ I want to compute $\displaystyle \int_0^n \left[\frac x {x+1} + \frac x {2x+4} + \frac x {3x+9} + \cdots \right] \, dx$ for $x>0$
My attempt: The integrand can be written as a sum of $\displaystyle f_k(x)=\frac x{kx+k^2}$ which is positive for $x>0$, can we interchange sum and integral here? If so, then $\displaystyle \int_0^n \frac x{kx+k^2}=1-\log(2)$, so the given integral diverges?

\begin{align}
\sum_{k = 1}^{n}{x \over kx + k^{2}}
&=
\sum_{k = 1}^{n}\left({1 \over k} - {1 \over k + x}\right)
=
\sum_{k = 0}^{n - 1}{1 \over k + 1} - \sum_{k = 0}^{n - 1}{1 \over k + x + 1}
\\[3mm]&=
\left\lbrack\Psi\left(1 + n\right) - \Psi\left(1\right)\right\rbrack
-
\left\lbrack\Psi\left(1 + n + x\right) - \Psi\left(x + 1\right)\right\rbrack
\end{align}
\begin{align}
&\int_{0}^{n}\sum_{k = 1}^{n}{x \over kx + k^{2}}\,{\rm d}x
=
\left\lbrack\Psi\left(1 + n\right) - \Psi\left(1\right)\right\rbrack n
-
\left\lbrack%
\ln\Gamma\left(1 + 2n\right)
-
\ln\Gamma\left(1 + n\right)
\right\rbrack
\\[3mm]&+
\\[3mm]&
\left\lbrack%
\ln\Gamma\left(1 + n\right)
-
\ln\Gamma\left(1\right)
\right\rbrack
=
1 + \left\lbrack\Psi\left(n\right) + \gamma\right\rbrack n
-
\ln\left(2n\right)
-
\ln\Gamma\left(2n\right)
+
2\ln\left(n\right)
+
2\ln\Gamma\left(n\right)
\end{align}
$$
\begin{array}{|c|}\hline\\
\color{#ff0000}{%
\int_{0}^{n}\sum_{k = 1}^{n}{x\,{\rm d}x \over kx + k^{2}}
=
1 - \ln\left(2\right) + \left\lbrack\Psi\left(n\right) + \gamma\right\rbrack n
-
\ln\Gamma\left(2n\right)
+
\ln\left(n\right)
+
2\ln\Gamma\left(n\right)}
\\ \\ \hline
\end{array}
$$
\begin{align}
&\left.
\int_{0}^{n}\sum_{k = 1}^{n}{x \over kx + k^{2}}\,{\rm d}x
\right\vert_{n\ \gg\ 1}
\!\!\!\!\!\!\!\!\!\!\sim
1 - \ln\left(2\right) + \left\lbrack\ln\left(n\right) - {1 \over 2n} + \gamma\right\rbrack n
+
\ln\left(n\right)
+
\left({1 \over 2} - 2n\right)\ln\left(2\right) - {1 \over 2}\,\ln\left(n\right)
\\[3mm]&=
n\,\ln\left(n\right) -
\left\lbrack 2\ln\left(2\right) - \gamma\right\rbrack n
+
{1 \over 2}\,\ln\left(n\right)
+
{1 \over 2}\left\lbrack 1 - \ln\left(2\right)\right\rbrack
\end{align}
$$
\begin{array}{|c|}\hline\\
\color{#ff0000}{\large%
\int_{0}^{n}\sum_{k = 1}^{n}{x \over kx + k^{2}}\,{\rm d}x\
\sim\
n\,\ln\left(n\right)\,,
\qquad
n \gg 1}
\\ \\ \hline
\end{array}
$$
