A continuous real function $f:[2, \infty] \to \mathbb R$ such that $|f|^p$ is integrable only for a given $p >1$. Is there such a continuous real function $f:[2, \infty] \to \mathbb R$ such that $|f|^p$ is integrable only for a given $p >1$.
My first attempt is to try to look at functions such as $x^{\alpha}(logx)^{\beta}$ which is a typical example of similar questions, but apparently it does not work here. 
 A: Let $a,b>0$. Note that $x^{-1/a} \chi_{(0,1)}(x)$ is in $L^q$ exactly for $q \in [0,a)$. Similarly, $x^{-1/b} \chi_{(1,\infty)}(x)$ is in $L^q$ exactly for $q \in (b,\infty]$. Summing these gives a function in $L^q$ exactly for $q \in [0,a) \cap (b,\infty]=(b,a)$. 
Now take your favorite $\epsilon_n \to 0^+$, with $\sup \epsilon_n \leq p$. Take $f_n \in L^q$ for $q \in (p-\epsilon_n,p+\epsilon_n)$ using the construction in the previous paragraph. Then $f=\sum_{n=1}^\infty 2^{-n} \frac{f_n}{\| f_n \|_{L^p}}$ does the job.
This construction is for the domain $(0,\infty)$ or a superset thereof, but it is easy to translate it to any other infinite interval.
This can be adapted to create a function continuous on $[0,\infty)$ including the left endpoint. The second one is easy to deal with, just replace $x^{-1/b} \chi_{(1,\infty)}(x)$ by $\begin{cases} 1 & x \in [0,1] \\ x^{-1/b} & x \not \in [0,1] \end{cases}$. Or you can take pretty much any other bounded, continuous extension.
The first case is not so easy to deal with. Intuitively you need to place spikes that get taller but narrower as $x \to \infty$. Such a spike centered at $0$ looks like $f(x;M,\delta)=\begin{cases} 0 & x \not \in [-\delta,\delta] \\ \frac{M}{\delta}(x+\delta) & x \in [-\delta,0] \\ M-\frac{M}{\delta} x & x \in [0,\delta] \end{cases}$. One can then sum such spikes, centered at, say, $n=0,1,\dots$ for growing $M$ and shrinking $\delta$ to get a function in $L^p$ exactly for $p \in [0,a)$ again. It will help to recall the convergence/divergence behavior of the "$p$ series".
Then you use modifications of these two functions in the same way I suggested in the second paragraph.
A: HINT:
Take $f$ that equals $\frac{1}{n \log^2 n}$ on $[n, n+1)$ and $\frac{n}{\log^2 n}$ on $[\frac{1}{n+1}, \frac{1}{n})$. This will work for only $p=1$. For general $p>0$, take a conveninent power of $f$. 
A: Let $p>1$, then $f(x) = \frac{1}{(x-2)^{1/p}(1+|\log(x-2)|)^{2/p}} \in L^p[2,\infty]$, because
$$\int_{2}^{\infty}  \frac{dx}{(x-2) (1+|ln(x-2)|)^2}=2$$
But $f(x) \notin L^q[2,\infty]$, for $q \neq p$.
