Let $X=(0, \infty)$, $\mu$ is Lebesgue measure on $X$, and $$f(x)= \dfrac{1}{\sqrt{x} [1+|\log x|]}$$
Then $f \in L_p$ if and only if $p=2$.
I was able to show that for $p = 2$ we have $f \in L_2$.
But I can not show that if $f \in L_p$ then necessarily $p = 2$.
Anyone have any idea how to do this? My attempt was to find a function less than $f$ that is not integrable, but it does not give the condition on $p$.
Hints: use the fact that $\int_0^{\infty} e^{tx}\frac 1 {(1+x)^{p}} \, dx =\infty$ if $t>0$ which can be proved easily from the fact that the integrand tends to $\infty$ as $x \to \infty $. If $p >2$ show that $\int_0^{1} f^{p}(x)\,dx =\infty$ by making the substitution $y=-\log x$. If $p<2$ show that $\int_1^{\infty} f^{p} (x)\,dx=\infty$ by making the substitution $y=\log x$. [ Let $p>2$ and make the substitution $ y=-log \, x$ to get $\int_0^{1} f^{p} =\int _0^{\infty} e^{(\frac p 2 -1) y} (1+y)^{-p} \, dy$. For any $a>0$ we have $\int_0^{\infty} e^{ay} (1+y)^{-p} \, dy=\infty$ (for this you can use the fact that $e^{ay} (1+y)^{-p} \geq c e^{(a/2)y}$ for some $c>0$ and $y$ sufficiently large); so $\int_0^{1} f^{p} =\infty$. I will leave the case $p<2$ to you].