Solution:
X is greater than some multiple of m1 by x1, and greater than some multiple of m2 by x2. That means, we need to find out multiple of m1 and m2 which has the difference of x1 - x2 when x1 > x2. Otherwise we need to find out multiple of m1 and m2 which has the difference of x2 - x1. That means, If there exists an X, then there exists two integers r and s such that
m2*s - m1*r = x1 - x2 if x1 > x2
m1*r - m2*s = x2 - x1 otherwise
And for both of the cases X = m2*s + x2 = m1*r + x1;
Now,the next such pair of multiple of m1 and m2 can be found by adding some multple of m1 to m1*r and by adding some multiple of m2 to m2*s. But to preserve the equality these two multiples need to be equal. That means they need to be common multiple of m1 and m2. The lowest common multiple of m1 and m2 are m1*m2 as they are co-prime.
Lets say there exist one X such that 0 <= X < m1*m2 (actually at least one such X exist which is provable but not mentioned here); Then the next possible value of X will be, X = m2*s + m1*m2 + x2 = m1*r + m1*m2 + x1 >= m1*m2
That means there exist at most one X such that 0 <= X < m1*m2
No comments:
Post a Comment