Modular Arithmetic: 4^123456754 mod 5
[Modular arithmetic] -1 mod 5 = 4. Why?
ELI5 What is mod or modular numbers?
Best realism mods for SH 3/4/5?
How much is 17 mod 3?
17 mod 3 equals 2 since dividing 17 by 3 gives a quotient of 5 and a remainder of 2. The remainder is the result of the modulus operation. In simpler terms, 17 mod 3 = 2.
How to calculate modulo division?
To calculate modulo division: subtract the divisor from the dividend until the resultant is less than the divisor.
What are the components of modulo division?
The components of modulo division are dividend, divisor, quotient, and remainder. The remainder is the answer or end result of the operation.
Videos
I get that you need to break up the exponent into smaller pieces but I’m not sure how to do so since my class didn’t really go in depth on that.
So modulo is the remainder of integer division. It all makes sense for positive integers. But how should I think when it comes to negative numbers?
-1 mod 5 = 4.
I can reason my way to this by saying that from -1 there are 4 steps to the nearest multiple of 5, i.e -5. But why is the answer 4 and not -4? I should go to the negative side on the number line to get to the nearest multiple of 5. Please help me sort this out.
What does it mean when someone says "mod 4" when referring to numbers? Also, how/why is it used in CS?