# Prove prime number p divides 1+…+n^{p-2}

I am working on a problem in number theory:

Problem: Let $$p>2$$ be prime. Let $$n$$ be an integer with $$\gcd(n,p)=1$$ and $$n\not\equiv1\pmod{p}$$. Prove that $$p\mid(1+n+n^2+n^3+\dots+n^{p-2})$$.

Right now, I am trying to solve this problem with Fermat's Little Theorem. The Theorem tells me $$n^p\equiv n\pmod{p}$$. Then I have $$n(n^{p-1}-1)\equiv0\pmod p$$, so I know $$p\mid n(n^{p-1}-1)$$. Because $$p\not\mid n$$, I know then that $$p\mid(n^{p-1}-1)$$. From here, I am stuck and cannot see how to proceed. Thank you in advance for assistance.

• Hint: first consider whether $p\mid(1+n+n^2+n^3+\dots+n^{p-2})(1-n)$. – Greg Martin Feb 2 at 17:13

## 1 Answer

Since $$n\not\equiv1\pmod{p} \implies n \neq pk+1 \implies n-1 \neq pk \implies p \nmid n-1$$.

As Greg Martin mentions, consider $$(1+n+n^2+n^3+\dots+n^{p-2})(1-n)=1-n^{p-1}$$.

By Fermat's Little Theorem, for any prime $$p$$ we have $$n^{p-1} \equiv 1 \pmod p \implies p\mid 1-n^{p-1} \implies p \mid (1+n+n^2+n^3+\dots+n^{p-2})(1-n).$$

But $$p \nmid n-1$$, so $$p\nmid 1-n$$ and $$p \mid(1+n+n^2+n^3+\dots+n^{p-2})$$.