Found a solution. Original equation
RESULT = (CONST + var) % MOD
Let NEWMOD be an enlarged or reduced MOD .
var = NEWMOD - (CONST - RESULT) % NEWMOD
On examples.
On the original example.
(25 + 15) % 16 = 8
CONST = 25var = 15MOD = 16RESULT = 8
Increase:
NEWMOD = MOD + 1 = 17 var = 17 - (25 - 8) % 17 = 17 - 0 = 17 (25 + 17) % 17 = 8
Decrease:
NEWMOD = MOD - 1 = 15 var = 15 - (25 - 8) % 15 = 15 - 2 = 13 (25 + 13) % 15 = 8
UPD: As for the proof.
Transfer the result to another part of the equation or, more simply, reduce both parts by the value of the result.
Because on the right side, we do not have division, but the remainder of it, then it is permissible.
CONST + var >= RESULT
because RESULT is the remainder of the division
(25 - 8 + var) % 16 = 0 => (17 + var) % 16 = 0
In other words (special case):
17 + var = 16 => var = 16 - 17 = -1 (25 + (-1)) % 16 = 8
I must say that the answer here is not one. The answer will be numbers with an interval in the value of the module.
In this case: -1, 15, 31, 47, etc.