How to find $n$ on equations that look like $\mathrm{gcd}(n, x)=y$.

51 Views Asked by At

How to find the $n$ in equations like $\gcd(n, x)= y$ for some random $x,y$?

For example, I want to find $n$ if $B=n+3$ and $\gcd(B,10)=5$.

What I know is that $5$ divides $B$ and $10$ so it divides $B-10$. So $n+3-10=5k$ so $n= 5k+2$ but when I saw the solution it says $n=10k+2$.

Why is that? Thanks