Given $$f(x) = \sum_{k = 0}^\infty \frac{x + k}{\mathrm{e}^k}$$ find the integral $$\int_0^2 f(x) \mathrm{e}^{-x} \,\mathrm{d}x.$$
I have found the sum can be rewritten in terms of $\mathrm{e}$ to the $-k$ power plus a constant (sum of $\dfrac k{\mathrm{e}^k}$). Then, after plugging in $f(x)$ and using $u$-substitution, I was able to get as far as the integral in terms of $k$. Maybe someone can validate?
Note that $$f(x) = \sum_{k = 0}^\infty \frac{x + k}{e^k}=\left(\sum_{k=0}^\infty\left(\frac1e\right)^k\right)x+\sum_{k=0}^\infty ke^{-k}=Ax+B$$ so you are essentially doing $$A\int_0^2 xe^{-x}\,dx+B\int_0^2e^{-x}\,dx$$ and integrating by parts gives $$A[-xe^{-x}]_0^2+(A+B)\int_0^2 e^{-x}\,dx=\boxed{-\frac{2A}{e^2}+(A+B)\left(1-\frac1{e^2}\right)}$$