# Modular Arithmetic and Fermat

Question: Find the smallest non-negative integer solution (if any exist) to the equation

$$x^{2017^2} + x^{2017} + 1 \equiv 0\mod\ 2017$$

Hint: You may use the fact that 2017 is a prime number. Fermat’s Theorem can help with this problem.

I have attempted to apply some addition rules to get

$$x^{2017^2} \equiv 0\mod 2017$$ $$x^{2017}\equiv 0\mod\ 2017$$ $$1 \equiv 0\mod\ 2017$$

and have gotten stuck. I have also tried to think about how $x^{2017^2} + x^{2017} + 1 = 2017n$ to satisfy the "$0\mod \ 2017$" portion but cannot get much further. I also am not quite sure how to successfully utilize Fermat's Theorem to solve this. I played around a bit but didn't get far.

• If $n$ is an integer, then $n^{2017}$ is congruent to what mod $2017$? – quasi Apr 1 '17 at 22:35
• Also, if my "system" of equations is correct, then x must be zero to satisfy a Corollary coming from Fermat's Theorem stating that if $a\in Z, a^p \equiv a\mod \p$ – M Paul Apr 1 '17 at 22:35
• User fermats theorem: $x^{2017} \equiv x \mod 2017$ – fleablood Apr 2 '17 at 1:28
• If $x \equiv 0$ then $1 \equiv 0 \mod 2017$ so that isn't a solution. So $\gcd(x,2017) = 1$. So $x^{2016} \equiv 1 \mod 2017$. – fleablood Apr 2 '17 at 1:30

Fermat's little theorem tells us that $x^{2017} \equiv x \pmod{2017}$. (It's usually stated as $x^{2016} \equiv 1 \pmod{1027}$ for $x$ not divisible by $2017$, but the first form is more useful in this case.)
But probably the first stumbling block in this problem is noticing that $x^{2017^2} = (x^{2017})^{2017}$, and therefore this equation can be rewritten as $$(x^{2017})^{2017} + x^{2017} + 1 \equiv 0 \pmod{2017} \implies x^{2017}+x+1 \equiv 0 \pmod{2017}.$$ (Even if Fermat's little theorem did not apply, the substitution $y = x^{2017}$ would be a good one at this point, but as it is we'd just have $y \equiv x \pmod{2017}$ if we did that.)
Another round of Fermat's little theorem, and we get $$x^{2017}+x+1 \equiv 0 \pmod{2017} \implies x + x + 1 \equiv 0 \pmod{2017}$$ so $2x+1 \equiv 0 \pmod{2017}$, which we can solve to get $x \equiv 1008 \pmod{2017}$.
{"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 1, "mathjax_display_tex": 1, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}