Q: simple modular arithmetic I am trying to solve a programming problem but am stuck on some modular algebra. The equation I am trying to solve boils down to $$a \equiv (b + cx)\pmod {10^9+7}$$ where I know a, b, and c and need to solve for x. Is there a way to do this? Sorry if this is a bad question, math has become a little foreign to me. Thanks in advance.

I'm assuming $(c,10^9 + 7) = 1$, so you can ensure a solution exists. Since $10^9 + 7$ is prime, Fermat's little theorem gives $$c^{-1} \equiv c^{10^9 + 5} \pmod{10^9 + 7},$$ so a solution can be given by
$$
x = c^{10^9 + 5}(a-b),
$$
but this isn't easily computable.
