I solved a problem in analysis and i was thinking of generalizing this question which i couldn't succeed.
If $f:\mathbb{R} \to \mathbb{R}$ is a continuous function which satisfies $f(x)=f(2x+1)$, for all $x \in \mathbb{R}$ then prove that $f$ is constant. I was able to prove it considering $g(x)=f(x-1)$ and showing that $g(x) \to g(0)$.
Now my question is suppose $f: \mathbb{R} \to \mathbb{R}$ is a continuous function and satisfies $f(p(x))=f(x)$ for every polynomial $p(x) \in \mathbb{R}$, then what should be the condition on $p(x)$ such that $f$ remains constant.