How does 3 modulo 7 = 3?
12,018
Solution 1
Your reasoning is correct. Any time the divisor is larger than the dividend, the result of the modulo operation equals the dividend.
Solution 2
7*x + y = 3, x and y are int, and x >= 0,
what y = ?
yes, y = 3.
Author by
App
Updated on June 14, 2022Comments
-
App over 1 year
I was wondering how modulo works. I know how it works when the bigger number comes first, but not the opposite. I know that
7 % 3 = 1
as 3 goes up to 7 2 times and the remaining is 1. However, when it's3 % 7
. I have used the calculator it shows 3. Is this because 7 goes up to 3 zero times and the remaining is 3? Is that how it works? -
App almost 7 yearsOk, what about 3^15 % 17. How is that 6? 3^15 = 14348907. 14348907 / 17 = 844053
-
Justin Niessner almost 7 years@App - Because the divisor (17) is not larger than the dividend (14348907).
-
App almost 7 yearsHow come? It is larger?
-
Justin Niessner almost 7 years@App - Sorry. Apparently I can't think today. I had my comment backwards.
-
App almost 7 yearsOk, but how do I get 6?
-
Justin Niessner almost 7 yearsBecause 17 goes in to 14348907 844053 times w/ a remainder of 6? I'm not sure what you're not understanding.