Divisibility and PrimesGcd

To find X, we simply need to multiply all numbers which are prime factors of 18 and 30:

X  =  2 × 3  =  6.