I am trying to prove that $\lim_{k\to\infty}\int_{1/k}^k f(x)\,dx$ is not always equal to $\int_0^{\infty}f(x)\,dx$, where $\int_0^{\infty}f(x)\,dx=\lim_{R\to0}\lim_{S\to\infty}\int_R^Sf(x)\,dx$.
It seems that there should be a counterexample where $f(x)\to\infty$ as $x\to0$ and $x\to\infty$ with $\lim_{k\to\infty}\int_{1/k}^kf(x)\,dx=0$ but $\int_0^{\infty}f(x)\,dx$ does not exist.
For example, I tried $f(x)=|\ln x|$, but this does not work since then $\lim_{k\to\infty}\int_{1/k}^k f(x)\,dx$ does not exist.
For every example I have tried so far, they are the same. Can anyone suggest how to construct a counterexample?
Another example such that $$\lim_{A\to\infty}\int_{1/A}^Af(x)\,dx\neq\int_0^\infty f(x)\,dx.$$ Here $A$ tends to infinity through the real line rather than $\mathbb N$. Let $$f(x)=\begin{cases} \frac1x & x\geq1,\\ -\frac1x & 0<x<1. \end{cases}$$ So $\int_{1/A}^Af(x)\,dx=0$ for $A>1$ but $\int_0^\infty f(x)\,dx$ does not exist.