The difference between the HCF and LCM of $x$ and $18$ is $120$. Find $x$. 
The difference between the HCF and LCM of $x$ and $18$ is $120$. Find $x$.

What I Tried: Let $\gcd(x , 18) = y$ and lcm$(x , 18) = z$ . Also, $z \geq y$ . We have :-
$$\rightarrow 18x = yz$$
And :-
$$\rightarrow z - y = 120$$
$$\rightarrow\frac{18x}{y} - y = 120$$
$$\rightarrow 18x - 120y - 120 = y^2$$
From here, we get that $6 | y^2$ $\rightarrow 6 | y$ .
After doing this, I am stuck. I do get this information but I am not able to use it somehow for $x$ , I could show that $x = 6k$ , but what to do next?
Can anyone help me? Thanks.
 A: No casework needed.
$\gcd(x,18) + 120 = \text{lcm} (x,18) \implies \gcd(x,18) \equiv -120 \equiv 6 \pmod{18}$
Therefore $\gcd(x,18)=6, x = \gcd(x,18)\cdot \text{lcm}(x,18)/18 = 6 \cdot 126/18=42$.
A: Since $y\le 18,y=6,12,18$. Reject $12$ since it is not a factor of $18$.
We get corresponding $z=120+y=126,138$. Reject $138$ since it is not a multiple of $18$.
We are left with $y=6,z=126,x=yz/18=42$.
A: Hint:
as $\text{lcm}(x,18)$ is even :$\gcd(x,18)$ is even .That is $\gcd(x,18)=2$ or $\gcd(x,18)=6$  or $\gcd(x,18)=18$
which do you think will work??
A: Another way:
WLOG $(x,18)=d>0$  and $\dfrac xp=\dfrac{18}q=d$
$\implies(p,q)=1$ and LCM$(x,18)=pqd$
and $120=pqd-d=d(pq-1)\implies p=\dfrac{\dfrac{120}d+1}q=\dfrac{\dfrac{120}d+1}{\dfrac{18}d}=\dfrac{120+d}{18}$
Clearly, $3|d$ and $2|d\implies d$ must be divisible by LCM$(2,3)=?$
As $d|18$ and $d|120,d$ must divide $(18,120)=6$
So, $d$ has a unique value!
A: One simple approach is to note that the HCF has to be a factor of $18$ and there are only $6$ of those to try.  We also know that the product of the HCF and LCM is $18x$ so we can make a table
$$\begin {array} {r r r r}HCF&LCM&18x&x\\ \hline 
1&121&121&NA\\
2&122&244&NA\\
3&123&369&NA\\
6&126&756&42\\
9&129&1161&NA\\
18&138&2484&138\end{array}$$
where the NAs come because $18x$ is odd.  Only $x=42, HCF=6, LCM=126$ works
