Quick calculation of modulo with large exponent

104 Views Asked by At

In a correction of an exercise, the teacher simply wrote down

$$2^{107}\text{mod }187 = 161.$$

Is there any way for this to be so easily calculated?

2

There are 2 best solutions below

0
On BEST ANSWER

We have $$2^{10}=1024\equiv89\pmod{187}$$ $$89^2=7921\equiv67\pmod{187}$$ $$67^2=4489\equiv1\pmod{187}$$ so $$2^{107}=2^{100}\cdot2^{7}=(2^{10})^{10}\cdot128\equiv89^{10}\cdot128\equiv67^5\cdot128\equiv67\cdot128=161\pmod{187}$$as desired.

10
On

use that $$2^{40}\equiv 1 \mod 187$$