<s>[INST] 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?
 [/INST] We have
\begin{align}
f(x) & = \sum_{k=1}^{\infty} \dfrac{x}{kx+k^2} = \sum_{k=1}^{\infty} \left(\dfrac1k - \dfrac1{k+x} \right) = \sum_{k=1}^{\infty} \int_0^1 \left(t^{k-1} - t^{k+x-1}\right)dt\\
& = \int_0^1 (1-t^x) \left(\sum_{k=1}^{\infty} t^{k-1} \right) dt = \int_0^1 \dfrac{1-t^x}{1-t} dt
\end{align}
We now have
$$I_n = \int_0^n f(x) dx = \int_0^n \int_0^1 \dfrac{1-t^x}{1-t} dt dx = \int_0^1 \dfrac{n + \dfrac{1-t^n}{\log(t)}}{1-t}dt$$
From WolframAlpha for $k=1,2,3,4,5$, we get the value of
$$J_k = \int_0^1 \left(\dfrac1{1-t} + \dfrac{t^{k-1}}{\log(t)} \right) dt = \gamma + \log(k)$$
Assuming this is true in general and noting that $I_n = \displaystyle \sum_{k=1}^n J_k$, we get that,
$$I_n = \sum_{k=1}^n J_k = n \gamma + \log(n!)$$
</s>