Fermats little theorem, $p$ is not a prime number

92 Views Asked by At

Calculate the remainder $$ r \equiv 37^{877} \bmod{323} $$

I don't know how to follow this up since $323$ is not a prime number.

1

There are 1 best solutions below

4
On

$323=17\cdot19$

Now $37\equiv -1\pmod{19}\implies37^{877}\equiv(-1)^{877}\equiv-1\ \ \ \ (1)$

and $37\equiv3\pmod{17}\implies37^{877}\equiv3^{877}\pmod{17}$ and $877\equiv13\pmod{17-1}$

Using Fermat's Little Theorem, $3^{877}\equiv3^{13}\pmod{17}$

$3^4\equiv-4\pmod{17}\implies3^{12}=(3^4)^3\equiv(-4)^3\equiv4$

$\implies3^{13}=3\cdot3^{12}\equiv3\cdot4\equiv12\pmod{17}\ \ \ \ (2)$

Now apply CRT on $(1),(2)$