Integrable function which limit does not go to 0 for x to infinity I want to find a function, such that the function shall be $p$-integrable in the sense of $\int_{\mathbb{R}}|f(x)|^pdx<\infty$ for any $p\in[1,\infty)$ and that this does NOT imply $\lim_{x\to\infty}f(x)=0$.
Now it's similar to the question here Continuous unbounded but integrable functions, but I'm not looking for a function which is unbounded in any point, just one which limit in infinity does not converge to $0$ or better say does not exist.
Does anyone know of any examples?
 A: There are, of course, a lot of examples of $p$ integrable functions such that the limit at infinity does not exist. For example, one can take the characteristic function of $\mathbb{Q}$. 
It should be noted, however, that there is no function such that $\lim_{x \rightarrow \infty} f(x)$ exists and is $ \ne 0$. 
Indeed, assume $\lim_{x \rightarrow \infty} f(x) = \alpha > 0$. Then, for every $\epsilon >0$, there exists $M>0$ such that 
$$
f(x) > \alpha - \epsilon \qquad \text{for every } x > M.
$$
If you take $\epsilon $ such that $ \alpha - \epsilon >0$ than you have that 
$$
\int_{\mathbb{R}} |f(x)|^p \, dx  \ge \int_{\{x > M\}}  (\alpha - \epsilon)^p \, dx= \infty. 
$$
A similar argument works for $\alpha < 0$.
A: Take $f$ to be a piecewise affine function. At each natural number $n$ the graph of $f$ is a triangle of height $1$ (so $f(n)=1$) and basis $\frac{1}{n^{2/p}}$ and $f$ is zero elsewhere. Then $\limsup_{x\to\infty}f(x)=1$ while
$$\int_0^\infty |f(x)|^p\,dx=\sum_n \frac1{n^2}<\infty.$$
A: See this post If $f\in L^1(\Bbb R,dx)$ then prove that for almost every $x\in\Bbb R$ $\lim\limits_{n\to \infty} f(nx) = 0.$
Where the function is a Polynomial on each interval $[n, n+\frac{1}{2^n}]$ and zero elsewhere.
