# Mutual convergence (divergence) of expectation with corresponding series

I'm solving an example from Allan Gut's Graduate Probability textbook, and struggling to prove that

$$\mathbb{E}(g(X))<\infty \iff \sum_{n=1}^\infty g'(n)P(X>n) <\infty$$ where g is a non-negative increasing differentiable function, and X is a non-negative r.v. I can more or less pull this off with specific functions by 'slicing' the integral in the formula $$\mathbb{E}(g(X))= g(0) + \int_{0}^\infty g'(x)P(X>x)dx$$ but this is only because I know how certain functions behave and can't really do it for an arbitrary g. Also I don't know if the author assumed differentiability everywhere, or a.e. (if it's the latter, then I think that g needs to be absolute continuous in order for the second equation to work).

I've also considered approaching the abovementioned series with the integral convergence test but that only works if I prove that g'(x)P(X>x) is monotone decreasing.