In other words, does the inequality,
$$\int_1^{i+1}f(x) \, dx \leq \sum_{n=1}^i a_n \leq \int_1^n f(x) \, dx+a_1,$$
only hold when $f(x)$ is continuous, monotone and decreasing?
Also $f(n)=a_n$.
In other words, does the inequality,
$$\int_1^{i+1}f(x) \, dx \leq \sum_{n=1}^i a_n \leq \int_1^n f(x) \, dx+a_1,$$
only hold when $f(x)$ is continuous, monotone and decreasing?
Also $f(n)=a_n$.
A theorem of Hardy states that for a nonnegative function $f$ (which is not necessarily monotone), the sum $\sum_{j=1}^nf(j)$ and the integral $\int_0^nf(t)\, dt $ converge or diverge together if $f$ has a continuous derivative satisfying
$$\int_0^{\infty}|f'(t)|dt < \infty.$$
The integral test also holds under weaker conditions where it is sufficient only that the total variation of $f$ on $[0,n]$ is bounded for all $n$.
A proof of Hardy's result is as follows:
Let $\{t\}$ denote the fractional part of $t$. Then
$$\int_0^n \{t\}f'(t) \, dt = \sum_{j=1}^n \int_{j-1}^j(t-j+1)f'(t) \,dt.$$
Integrating by parts,
$$\int_0^n \{t\}f'(t) \, dt = \sum_{j=1}^n \left[(t-j+1)f(t)|_{j-1}^j-\int_{j-1}^jf(t) \,dt \right] \\ = \sum_{j=1}^n f(j)-\int_{0}^nf(t)\,dt.$$
Hence, for all $n$
$$|\sum_{j=1}^n f(j)-\int_{0}^nf(t)\,dt| \leqslant \int_0^n|\{t\}f'(t)| \, dt \leqslant \int_0^{\infty}|f'(t)| \, dt < \infty.$$
From this final inequality, we can make comparisons to show that the integral and sum must converge or diverge together.