TITLE: Prime doesn't divide a certain polynomial
QUESTION [3 upvotes]: Let $q \geq 3$, $p \neq 1\pmod q$ be two primes. Show that there is no integer $x$ such that
$$ 1 + x + x^2 + \dots + x^{q - 1} = 0 ~~~~~~ \mod p $$
Now of course, you have to assume that such a number does exist and then arrive at a contradiction. I'm not looking for a solution but rather a hint, and how to (in general) look at these types of problems.
I have no idea why (for instance) it is impossible for 5 to divides $x^2 + x + 1$ (I took $q = 3$ and $p = 5$). I saw that for $x = 0, 1, 2, 3, 4, 5, 6, 7$, the values of $x^2 + x + 1$ are $1, 3, 7, 13, 21, 31, 43, 57,$ so it seems that $x^2 + x + 1$ modulo $5$ is $1, 3, 2, 3, 1$ (repeatedly). But why can it never be 5 (and thus zero)?

REPLY [2 votes]: Suppose that $x$ is a solution.  We note that $x\neq 1$ (as $p$ does not divide $q$)
Multiply by $x-1$ to see that $$x^q-1 \equiv 0\pmod p$$
Thus the order of $x\pmod p$ is a divisor of $q$.  Since the order can not be $1$, it must be $q$.  But the order of an element in a group divides the order of the group, so this means that $q\,|\,p-1$ and we have a contradiction.
{"set_name": "stack_exchange", "score": 3, "question_id": 2427370}