I was given this following question:
There exists a positive integer such that when it is divided by 5 the remainder is 4, when it is divided by 6 the remainder is 5, and when it is divided by 7 the remainder is 6. Find such least positive number that satisfies that above conditions.
My way of solving it is to first find the Least Common Multiple (LCM) for these three numbers.
LCM(5,6,7) = LCM(5, LCM(6,7)) = 210
And then I noticed that since the modulus operation for y/x is at most from 0 to x-1, and for x=5, 6, and 7, the remainder is always x-1. Then we can simply subtract 1 from 210 to obtain the answer of 209.
To this end, I am wondering if there's a better approach to solving this problem. Especially, is there a formula/relationship that we can follow if the problem is not numerically explicit. For example:
Find the least positive integer such that when it is divided by x the remainder is a, when it is divided by y the remainder is b, and when it is divided by z the remainder is c.
I would also like to know that if there's always exist such a least positive integer for any given combination of (x,y,z) and (a,b,c).