Calculate Modulo Of Large Numbers Using fx-82MS Calculator.

November 18th, 2024

Table of Contents

Introduction


Long story short, I got absolutely cooked by some encryption questions in my CS219: Cloud Computing Quiz 2 a while back. Now I’m not the biggest fan of maths to begin with, but deep down, this failure did not feel like a skill issue. Turns out it wasn’t. The questions required us to calculate the modulo of very large numbers, which is something the fx-82MS calculator wasn’t built for. This article will go over the work-around for this issue, and hopefully, you don’t end up losing marks like I did.

Calculating Mod


Before getting to large numbers, its good to understand how the modulo of smaller numbers are calculated. Take the following question as an example:

The first step is to divide 26 by 10. After we get the quotient, we remove the whole part and multiply it by the divisor.

The Mod Problem


The issue with this approach is that when using a fx-82MC calculator, you may not always get the correct quotient. The reason this issue occurs is due to the calculator rounding off or removing the extra precision from large divisions. Let’s try out another question:

The quotient that you get when using the calculator will be a whole number. But in reality, the quotient has a precision of 6 decimal places.

The Mod Solution


Luckily, here is a relatively simple solution to this problem. The first step is to break down the dividend into smaller combination of base-powers.

Now we have to calculate the modulo each part and multiply it to the next until we get to the last part.

Practice Questions


These are the questions I was unable to get the correct answers for. Have a go and see if you can solve them. You can find the solutions here.

Diffie-Hellman


Find the shared secret keys given a prime number p = 23 and integer g = 5, value for A = 7, and B = 9.

Rivest-Shamir-Adleman


Encrypt the message m = 30 given the two prime numbers p = 3 and q = 11. Value of e = 7, Find the value of d and decrypt the cipher text.

Final Thoughts


This article went over how to calculate the modulo of large numbers using a not so capable calculator. We broke our dividend into smaller parts and then did separate modulo calculations, multiplying the last remainder to the next. If you are still having trouble, just attempt similar questions and you’ll eventually get better at it. Best of luck with your cloud computing journey!

Subscribe?


Hi, if you like my work and want to get notified when I publish new content, feel free to subscribe. I'll shoot you an email every now and then.