I'm trying to prove this as part of a step by step proof that there are infinitely many primes congruent to $1$ modulo $3$. It is clear that $p$ is incongruent to $0$ modulo $3$ but I am having trouble proving that $p$ must be incongruent to $2$ modulo $3$.
Any hints would be much appreciated.
$f(X)=X^2+X+1$ is the third cyclotomic polynomial.
Let $p\ne3$ and $f(m)\equiv0\pmod 3$. Then $m^3\equiv1\pmod p$ but $m\not\equiv1\pmod p$. Thus $m$ has order $3$ in the multiplicative group modulo $p$. By Lagrange's theorem $3\mid p-1$.
Essentially the same argument shows that if $\Phi_n(m)\equiv0\pmod p$ where $p$ is a prime not dividing $n$, and $\Phi_n$ is the $n$-th cyclotomic polynomial, then $n\mid p-1$.