Continuous unbounded but integrable functions Many tricky exercises concern the quest for functions that satisfy particular conditions. For example, let us consider the spaces $C_p( \mathbb R), 1 \leq p < \infty$, of continuous functions on $\mathbb R$ such that $\int_{\mathbb R} \lvert f(x) \rvert^p \mbox{d}x < \infty$. I found the following exercises rather demanding:


*

*Find a function $f\in C_1(\mathbb R)$ such that $f$ is unbounded;

*Find a function $f \in C_1(\mathbb R) \backslash C_2(\mathbb R)$.


so one can deduce that $C_p \not\subset C_q$ if $p < q$.
I'm quite sure that a function defined to be zero everywhere except for triangular peaks of height $k$ and base $1/k^3$ centered on positive integers $k$ is a solution for both the exercises. (it's a simple matter to give to this function an explicit form, but I think it would be rather unclear.) 
Is it correct?
Can anyone give other examples? (for the one or the other exercise, not necessary a solution of both of them!)
 A: Yes, that's correct. You can change the spacing, the widths, heights, and shape of the peaks, you can add an integrable bounded strictly positive function, but the principle is the same, you need narrow high peaks marching off to infinity. 
A: See the answer here 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.
Consider $f:\Bbb R\to \Bbb R$
\begin{align*}
f(x)= \begin{cases}
2^{n/2}P_n(x)& \text{if} ~~ n\le x\le n+\frac{1}{2^n} ~~\text{$n\in\mathbb{N}$}\\
0 &\text{ if}~~~j+\frac{1}{2^j}\le x\le j+1~~\text{ $j\in\mathbb{N}$}\\ f(-x)& \text{if }~~x  <0.
\end{cases}
\end{align*}
where $P_n(x)= -2^{2n+2}(x-n)^2+2^{n+2}(x-n)$. One can check that $f$ is an even and continuous function. since $P_n(n)= P_n(n+\frac{1}{2^n})=0$. Next observe that $f\in L^1(\Bbb R)$ since
\begin{align*}
\int_\mathbb{R} f(x)\,dx= 2\sum_{n=0}^{\infty}2^{n/2}\int_{n}^{n+\frac{1}{2^n}} P_n(x) dx 
\\= 2\sum_{n=0}^{\infty}-4\cdot 2^{n/2}
\left[ \frac{2^{2n}}{3}(x-n)^3-\frac{2^n}{2}(x-n)^2\right]_{n}^{n+\frac{1}{2^n}}\\
= \frac43\sum_{n=0}^{\infty} \frac{1}{2^{n/2}}<\infty. 
\end{align*}
Moreover, for every $n\in\mathbb{N}$ one has
\begin{align*}
f(n+\frac{1}{2^{n+1}}) = 2^{n/2} P_n ( n+\frac{1}{2^{n+1}}) = 2^{n/2}\to \infty 
\end{align*}
Therefore $f$ is unbounded.
Another example
\begin{align*}
f(x)= \begin{cases}
2^{\frac32(n+1)} x- n2^{\frac32(n+1)}& \text{if} ~~ n\le x\le n+\frac{1}{2^{n+1}} ~~\text{$n\in\mathbb{N}$}\\
-2^{\frac32(n+1)} x= n2^{\frac32(n+1)} +2^{\frac{n+3}{2}}& \text{if} ~~ n+\frac{1}{2^{n+1}}\le x\le n+\frac{1}{2^n} ~~\text{$n\in\mathbb{N}$}\\
0 &\text{ if}~~~j+\frac{1}{2^j}\le x\le j+1~~\text{$j\in\mathbb{N}$}\\ f(-x)& \text{if }~~x  <0.
\end{cases}
\end{align*}
It is easy to check that $f\in L^1(\Bbb R)\cap C(\Bbb R)$
\begin{align*}
&\int_\mathbb{R} f(x)\,dx=2\sum_{n=0}^{\infty} 2^{-\frac{n+1}{2}}<\infty\\
&f(n)= f(n+\frac{1}{2^{n}})=0\qquad f(n+\frac{1}{2^{n+1}}) = 2^{\frac{n+1}{2}}\to \infty 
\end{align*}
