0

I am not so good at Mathematics so please kindly forgive my stupidity.

Basically, I am learning modular arithmetic for cryptography and so I am struggling in understanding how to do big modular arithmetic calculation without a calculator.

So for example, how would I do this question: 6^56 mod 19?

I get that you need to convert the power 56 into binary - so that would be 0111000. So like 2^32 + 2^16 + 2^8.

I then understand you have to do like:

6^8 mod 19 then 6^16 mod 19 and 6^32 mod 19.

I've been told I can use the chinese remainder theorem - but I want to know how to do this all.

Any help would be absolutely great! I like this stuff but I have been struggling a bit.

Bernard
  • 175,478
  • Please don't use phrases like 'kindly forgive my stupidity', no question is stupid and adding that is simply redundant and doesn't put you in a very good light. That said, Welcome to Mathematics Stack Exchange! – Lt. Commander. Data Jan 23 '19 at 15:15
  • 1
    CRT can be used when the modulus has more than one prime factor.. But your modulus $19$ is prime, so CRT won't help. – Bill Dubuque Jan 23 '19 at 15:17

1 Answers1

0

What you mention you have to perform is the fast exponentiation algorithm. However, usually one performs reductions that rest on Fermat's little theorem (or Euler's theorem if the modulus is composite). Here, it is particularly efficient:

As $6$ and the modulus are coprime, we know the $6^{18}\equiv 1\pmod{19}$, so that $$6^{56}\equiv 6^{56\bmod 18}=6^2\pmod{19},$$ therefore $\;6^{56}\equiv 36\equiv-2\:$ (or $17)\pmod{19}$.

Bernard
  • 175,478