Find $17^{341}\mod 5$.
I know this has to be solved using the Chinese Theorem or Fermat's Little Theorem, $341$ is a Poulet number, and the result equals $2$. But how can I prove this? I'm fairly new to modular arithmetic.
Find $17^{341}\mod 5$.
I know this has to be solved using the Chinese Theorem or Fermat's Little Theorem, $341$ is a Poulet number, and the result equals $2$. But how can I prove this? I'm fairly new to modular arithmetic.
For any number $a$ coprime to $5$, a direct consequence of lil' Fermat is that $$a^n\equiv a^{n\bmod \varphi(5)}\equiv a^{n\bmod 4}\mod 5.$$ Here $17\equiv 2\bmod 5\:$ and $\:341\equiv 1\bmod 4$, hence $$17^{341}\equiv 2 \mod 5.$$
First, you note that $17\equiv2\pmod 5$. So you need to calculate $2^{341}\pmod5$. Then you note that $2^4\equiv 1\pmod 5$. Now $341=340+1=85\times 4+1$. Then $$ 17^{341}\equiv2^{4\times 85+1}=(2^4)^{85}\,2\equiv 1^{85}\,2=2\pmod5. $$
$$17^{341} = (17^2)^{170} \times 17 = 189^{170} \times 17$$
So modulo $5$, you have $$17^{341} \equiv (-1)^{170} \times 2 \equiv 2 \quad [5]$$
As per Fermat's Little Theorem, as $5$ is prime and $5\not\mid 17$ then $ 17^4=17^{5-1}\equiv 1\pmod 5$. Thus, $17^{341}=17^{4\cdot 85+1}=(17^4)^{85}\cdot 17\equiv 1^{85}\cdot 17=17\equiv 2\pmod 5$.
Just to be ever so slightly different, let's just use Fermat's little theorem in the form $a^p\equiv a$ mod $p$ for primes $p$, and note that
$$341=2\cdot125+3\cdot25+3\cdot5+1$$
so that
$$17^{341}\equiv17^2\cdot17^3\cdot17^3\cdot17=17^9=17^5\cdot17^4\equiv17\cdot17^4=17^5\equiv17\equiv2\mod5$$
(e.g., $a^{2\cdot125}=(((a^2)^5)^5)^5\equiv((a^2)^5)^5\equiv(a^2)^5\equiv a^2$, invoking Fermat repeatedly).