I am trying to find the possible values of this expression.
(a mod 2*x)-(a mod x)
I suspect they might be 0 or x, but I’m really not sure. I can’t seem to be able to write down a proper argument.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are correct that the possible values are 0 and
x, assuming that bothaandxare positive. The logic is as follows.Let
ahave the formThen it is easy to see that
a mod x = b.For
a mod 2*x, ifp = 2*r(pis even) thenso that
a mod 2*x = bandp = 2*r + 1(pis odd) thenso that
a mod 2*x = x + b. Combining these results, the difference is eitherb - b = 0(whenpis even) or(x + b) - b = x(whenpis odd).