Given $A, B, C$ positive integers, $B < C,$
I would like some thoughts about (possibly efficient) ways to find the smallest integer $X$, where $0 < X < C$, such that:
$$A X + B \pmod{C - X} = 0$$
($u \pmod{ w}$ denotes the remainder of the division $u/w$)
Any pointers to similar equations? Where should I be looking? [Some iterative method would also be fine (provided not a brute search)]
$$ax+b=0\pmod{c-x}\Longleftrightarrow ax+b=k(c-x)=kc-kx\Longleftrightarrow$$
$$(a+k)x=kc-b\Longleftrightarrow x=\frac{kc-b}{a+k}$$