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. 



Continuous functions remaining constant
I'll assume, per Pete's comment above, that you are looking for polynomials $p(x)$ with real coefficients such that $f(p(x)) = f(x)$ implies $f$ is constant. 


It suffices (though I am not sure if this is necessary) then that $p(x)$ has a fixed point that is strictly unstable or strictly stable in the strict sense. In other words, there exists $x\_0$ such that $p(x\_0) = x\_0$ and such that $|p(x - x\_0)| > (1+\epsilon) |x-x\_0|$ for some $\epsilon > 0$ or $|p(x - x\_0)| < (1 - \epsilon)|x - x\_0|$. Basically the exact same argument you used to show the property for $2x+1$ can be used for this case. 


