What is the maximum number of distinct real roots of a polynomial whose coefficients are all $1$, $-1$ or $0$ ?
Experimentally, it seems the answer is $4$. (For example, $x^6-x^3-x^2+x$.)
I tried expressing the polynomial as $f(x)+g(x)$, where $f(x)$ has only even powers of $x$, and $g(x)$ has only odd powers of $x$, but I haven't been able to make this approach work.
Context: I've been exploring polynomials with integer coefficients, for example here and here.
There is no maximum.
For example, to construct such a polynomial with $6$ distinct real roots, start with any polynomial with $6$ distinct real roots, e.g. $p(x) = x^6 -4x^4+3x^2-x$. Consider $$f_m(x) := x^{6m}- (x^{4m+6}+x^{4m+4} + x^{4m+2} + x^{4m}) + (x^{2m+4}+x^{2m+2}+x^{2m}) - x^m$$ for $m$ large and odd. Since $f_m(x^{1/m})$ converges pointwise to $p(x)$ as $m$ goes to infinity, $f_m(x)$ has at least as many real roots as $p(x)$ for $m$ sufficiently large.
Edit:
I previously wrote $$f_m(x) = x^{6m}- (x^{4m+3}+x^{4m+2} + x^{4m+1} + x^{4m}) + (x^{2m+2}+x^{2m+1}+x^{2m}) - x^m,$$ but this was wrong, as Sil noticed in the comments. When $x$ is negative the grouped terms cancel instead of combining, which causes $f_m(x^{1/m})$ to converge to $x^6 +x^2-x$ when $x$ is negative and $x^6-4x^4+3x^2-x$ when $x$ is positive. Now $f_m(x)$ is constructed so all of the exponents of the grouped terms have the same parity.