1

Determine the remainder of $5^{2017}$ when divided by 7.

I know that we need to use mod 7 to find all of the different remainders but I am not sure what specific steps to take and how to finish it out.

Please use Mod 7 as this question is very specific in the way it needs to be worked out.

  • I guess you can learn everything you need by studying the examples collected here. I would vote to close this as a duplicate of that one but I have promised not to. – Jyrki Lahtonen Dec 10 '17 at 20:33

4 Answers4

1

By Fermat little theorem we have $5^6\equiv_7 1$ so we have $$5^{2017} = (5^6)^{336}\cdot 5 \equiv_7 5$$ so the remainder is 5.

nonuser
  • 90,026
0

For these type of questions, always use Fermat's Little Theorem :

$$a^{p-1} \equiv 1\pmod p $$

Where $p$ is a prime number and $\gcd(a,p)=1$

Here $p=7$ and $a=5$

Therefore :

$$5^{7-1}\equiv 1\pmod {7} \implies \left(5^{6}\right)^{336}\equiv 1^{168}\pmod {7} $$

Hence :

$$5^{2016} \equiv 1\pmod {7}$$

Multiplying $5$ both the sides :

$$5^{2017} \equiv 5 \pmod {7}$$

Jaideep Khare
  • 19,293
0

There is no need to avoid Fermat. You also could use "modular exponentiation:

Use the modular exponentiation algorithm to find $13^{277} \pmod {645}$

For example, start with $5^2\equiv 4 \mod 7$, and then square: $5^4\equiv 4^2\equiv 2\bmod 7$, and then iterate.

Dietrich Burde
  • 130,978
0

The powers of $5$ modulo $7$ obviously form a finite set. So one can try and look at a few values in order to get the idea: \begin{alignat}{2} 5^0&\equiv 1&&\pmod{7}\\ 5^1&\equiv 5&&\pmod{7}\\ 5^2&\equiv 5\cdot 5\equiv 25\equiv 4&&\pmod{7}\\ 5^3&\equiv 4\cdot 5\equiv 20\equiv 6&&\pmod{7}\\ 5^4&\equiv 6\cdot 5\equiv 30\equiv 2&&\pmod{7}\\ 5^5&\equiv 2\cdot 5\equiv 10\equiv 3&&\pmod{7}\\ 5^6&\equiv 3\cdot 5\equiv 15\equiv 1&&\pmod{7} \end{alignat} Oh, good! Each time we have power $6$ we can reduce it to $1$ (modulo $7$). Since $$ 2017=6\cdot 336+1 $$ we are done! Indeed, $5^{2017}=(5^6)^{336}\cdot 5\equiv 1^{336}\cdot 5\equiv 5\pmod{7}$.

Fermat's little theorem, or, better, the Euler-Fermat theorem, is a generalization:

Theorem (Euler-Fermat). If $\gcd(a,n)=1$, then $a^{\varphi(n)}\equiv 1\pmod{n}$. In particular, if $p$ is prime and $p\nmid a$, then $a^{p-1}\equiv 1\pmod{p}$.

Here $\varphi$ is Euler's totient function: $\varphi(n)$ is the number of integers in the range $[0,n-1]$ which are coprime to $n$. For $p$ a prime, we obviously have $\varphi(p)=p-1$.

In case the prime is big, it would be a nuisance to compute all the powers like I did above for $7$.

Little Fermat's theorem is

Theorem (Fermat). If $p$ is prime, then $a^p\equiv a\pmod{p}$, for every integer $a$.

egreg
  • 238,574