TITLE: Does $x$ always exist?
QUESTION [5 upvotes]: If $m$, $n$ and $p$ are fixed positive integers such that $p$ is a prime and $\text{gcd}(m,n) = \text{gcd}(n,p) = 1$, does an integer $x$ always exist, such that,      
$$ nx \equiv m \pmod p $$    
I was looking at modular equations involving rationals and this question came to mind.    
Any help will be appreciated.
Thanks.

REPLY [2 votes]: You just need $\gcd(n,p)=1$ and $p$ need not be prime.
Indeed, by Bézout’s identity, there exist integers $a$ and $b$ such that $an+bp=1$, so you have $an=1-bp$ and
$$
anx=(1-bp)x=x-bpx\equiv x\pmod{p}
$$
Thus you get your desired solution to $nx\equiv m\pmod{p}$ by
$$
x\equiv am\pmod{p}
$$
If you want the minimum positive solution, it will be of the form
$$
am+kp
$$
for a suitable integer $k$.