Question 921969
it does change with a negative number but i came up with a different answer than you did.


i got:


101 modulo 3 = 2
-101 modulo 3 = 1


i believe the rule is as follows:





-x modulo y = y - x modulo y


where x >= 0 so that, if x = 5, then -5 is equal to -x.


based on that rule, -101 module 3 is equal to 3 minus 101 module 3 which is equal to 3 minus 2 which is equal to 1.


-101 modulo 3 is not 3 as you stated.


i verified with an online modulo calculator and with excel mod function.


the results of my excel calculations are shown below:


these results confirm the rule is good.


<img src = "http://theo.x10hosting.com/2014/111001.jpg" alt="$$$" </>


it was difficult to find a reference on the web that didn't confuse me more than i was before i started looking.


after a while i was able to piece it together.


some of the better links i looked at are shown below.


as you will be able to see, there are numerous different methods for how to calculate the modulo of a negative number.


<a href = "https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic" target = "_blank">https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/what-is-modular-arithmetic</>


<a href = "https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-quotient-remainder-theorem" target = "_blank">https://www.khanacademy.org/computing/computer-science/cryptography/modarithmetic/a/the-quotient-remainder-theorem</>


<a href = "https://answers.yahoo.com/question/index?qid=20080922034737AAsFEfY" target = "_blank">https://answers.yahoo.com/question/index?qid=20080922034737AAsFEfY</>


<a href = "http://www.miniwebtool.com/modulo-calculator/?number1=-340&number2=60" target = "_blank">http://www.miniwebtool.com/modulo-calculator/?number1=-340&number2=60</>


<a href = "http://mathforum.org/library/drmath/view/52343.html" target = "_blank">http://mathforum.org/library/drmath/view/52343.html</>