I am trying to solve the following equation:

$(a*n + c) \mod (b-n) \equiv 0$

and $n$ must be the lowest value in $[0, b-1]$

for example $a=17$, $c=-59$ and $b=128$, the solution is $n=55$

$n=b-1$ will be always a solution, because $m \mod 1 \equiv 0$