The function that $\lim_{n \to \infty} f(n+x) = 0$, but $\lim_{x \to \infty} f(x) \neq 0$?

Let $f:[0, \infty) \rightarrow \mathbb R$, and suppose $f$ satisfies $\lim_{n \to \infty} f(n+x) = 0 , x \in [0,1]$. Is $\lim_{x \to \infty} f(x) = 0$?

I've already proved that the statement is right if $f$ is uniformly continuous, but I'm trying to find counterexample if $f$ is just a continuous function.

Some other questions mention about the function that is zero everywhere except at the intervals $[n-1/n, n]$, where its graph forms an isosceles triangle of height $1$. Although this can be a good counterexample, it is not quite clear to me actually. Is there any other good counterexample?

• It sounds like you have already a counterexample. I'd be tempted to make the height of the isosceles triangle $n$, so that the function is unbounded! – Angina Seng May 21 '17 at 10:53
• Is your convergence in the second line uniform or just pointwise. – hamam_Abdallah May 21 '17 at 10:57

Assume $f_n\colon[0,1]\to \Bbb R$ is a sequence of (continuous) functions such thet $f_n\to 0$ pointwise, but not uniformly. Now we can define a continuous function $f\colon[0,\infty)\to\Bbb R$ by letting $f(x)=f_{\lfloor x\rfloor}(x-\lfloor x\rfloor)$.
• The pointwise convergence to $0$ of the $f_n$ is equivalent to $\lim_{n\to\infty}f(x+n)=0$ for all $x\in[0,1)$.
• The lack of uniform convergence of the $f_n$ to a constant function is equivalent to the non-existence of $\lim_{x\to\infty}f(x)$
• In order to ensure that $f$ is continuous, we need some simple condition on the $f_n$, namely that $f_n(1)=f_{n+1}(0)$ for all $n$.
An example of such a family would be $f_n(x)=\max\{0,1-|(n+1)x-1|\}$ (or, following Lord Shark's idea to even make $f$ unbounded: $f_n(x)=n\max\{0,1-|(n+1)x-1|\}$), where the condition in the third bullet point follows from $f_n(0)=f_n(1)=0$.