# How to prove $gcd$ with prime factor decomposition?

So we know that $n=\prod_{p\in\mathbb{P}} p^{v_{n}(p)}$ is formula of factor decomposition.

How to show that $gcd(m,n) = \prod_{p\in\mathbb{P}} p^{min(v_{n}(p),v_{n}(p))}$ using factor decomposition?

I know that for example when we have $gcd(36,360)$, we can write $36$ as

$36 = 2^{p_1}3^{p_2}5^{p_3}$ which is $36 = 2^{2}3^{2}5^{0}$

and $360$ as

$360 = 2^{q_1}3^{q_2}5^{q_3}$ which is $360 = 2^{3}3^{2}5^{1}$

To get $gcd$ we now need to take smallest $p$ and $q$ for every pair with same base. In this case these are 2,2,0, therefore our $gcd(36,360) = 36$ which is obvious.

So, I can show that this is valid $gcd(m,n) = \prod_{p\in\mathbb{P}} p^{min(v_{n}(p),v_{n}(p))}$ through an example with numbers, but I need proof, and I don't know how to prove that.

That's just because $m|n$ iff $\nu_m(p) \leq \nu_n(p)$ for all relevant $p$, and then use the definition of greatest common divisor.