# Continuous function whose series of function values converges but its improper integral doesn't converge

Does a continuous function $$f: [1, \infty) \to [0,\infty)$$ exist, such that $$\sum_{k=1}^\infty f(k)$$ converges but $$\int_1^\infty f(x)\,dx$$ does not converge?

I need help coming up with an example. If $$\sum_{k=1}^\infty f(k)$$ converges, we know that $$f(k) \xrightarrow[k \to \infty]{}0$$. I tried to come up with a function that's constant $$0$$ on the natural numbers, so the convergence of the series is guaranteed. One idea was $$|\sin(x \pi)|$$, which also shows that $$f$$ itself doesn't necessarily need to converge, however I have no idea how to integrate that (Intuitively that integral shouldn't converge though). If there is an elementary example where it's really easy to see why it's true, I would appreciate it.

• $|\sin(x\pi)|$ is a good idea, because it gets at the real problem—the series only sums discrete values and in between a lot can happen. To integrate it, notice that $|\sin(x\pi)| = \pm \sin(x\pi)$, and the sign choice depends on which integers $x$ is between. Or you can use $\sin^2(x\pi)$, which wouldn't require any cases to integrate. Commented Aug 15 at 15:33

Your suggestion works. The function $$f: [1, \infty) \to [0, \infty)$$ given by $$f(t) = | \sin(\pi t) |$$ is periodic with period $$1$$, i.e., $$f(t + 1) = f(t)$$ for all $$t$$ in the domain (and $$T = 1$$ is the smallest such).
It's clear that $$f(k) = 0$$ for all $$k \in \mathbb{N}$$, so $$\sum_{k=1}^\infty f(k) = 0 < \infty,$$ and by breaking up $$[1, \infty) = [1, 2] \cup [2, 3] \cup \cdots \cup [k, k+1] \cup \cdots$$ \begin{aligned} \int_1^\infty \! f(t) \, \mathrm{d}t &= \int_1^\infty \! |\sin(\pi t)| \, \mathrm{d}t \\ &= \sum_{k=1}^\infty \int_k^{k+1} \!\!\!\!\!\sin(\pi t) \, \mathrm{d}t \\ &= \sum_{k=1}^\infty \int_0^1 \sin(\pi t) \, \mathrm{d}t \\ &= \sum_{k=1}^\infty \Bigl.\bigl( -\tfrac1\pi \cos(\pi t) \bigr)\Bigr|_0^1 \\ &= \sum_{k=1}^\infty \tfrac2\pi, \end{aligned} which clearly diverges to $$\infty$$.
Here's a picture of $$f(t)$$ (in red) and it's integral function $$F(t) = \displaystyle\int_1^t f(u) \, \mathrm{d}u$$ (in blue).
• @LinusDieLinse for example the monotone convergence theorem applied to the sequence $(f_n)_{n \in \mathbb{N}}$ $f_n := \chi_{[1,n]} \cdot f$ should work (where $\chi$ is the characteristic function of the set).