let us assume two numbers A and B. Now A is not divisible by B.
mod = A%B
now (A + mod*(B-1)) is divisible by B. Why???
for example
A = 3
B=5
-> mod = A%B = 3%5 = 3;
-> A + mod*(B-1) = 3 + 3*(5-1) = 3 + 12 = 15 which is divisible by B.
another example:
A = 17
B = 12
mod = 17%12 = 5
A + mod * (B-1) = 17 + 5*(12-1) = 17 + 5*11 = 72 which is divisible by B = 12.
Try for any example and this is true. But i want to know why.?