math - How will be changed the number by dividing the absolute value for storing the result of changing the divider? -
here formula: result = (const + var) % mod result - interger, >= 0 const , var , mod - interger, > 0 question: how calculate var if: mod incremented mod decremented result и const won't changed. not bruteforce. found solution. result = (const + var) % mod let, newmod - incremented or decremented mod . var = newmod - (const - result) % newmod examples. with original formula. (25 + 15) % 16 = 8 const = 25 var = 15 mod = 16 result = 8 incremented: newmod = mod + 1 = 17 var = 17 - (25 - 8) % 17 = 17 - 0 = 17 (25 + 17) % 17 = 8 decremented: newmod = mod - 1 = 15 var = 15 - (25 - 8) % 15 = 15 - 2 = 13 (25 + 13) % 15 = 8 upd: proof. we need substract result both parts. because that's not division (just remainder of division) can this. const + var >= result , result remainder of division (25 - 8 + var) % 16 = 0 => (17 + var) % 16 = 0 in other words (a special case): 17 + var = 16 =&g