Hint $\ $ If $\ p\nmid a,b\ $ then $\ (p^m a, p^n b)\, =\, p^{\min(m,n)} (a,b).\ $ Recurse the same way on $\,(a,b).$
Proof $ $ wlog $\,m = \min(m,n)\,$ so $\,(p^ma,p^nb) = p^m(\color{#c00}{a,p^{n-m}}b) = p^m(a,b)\,$ by Euclid's Lemma,
because, $ $ by $ $ hypothesis, $\,\ (a,p)=1,\ $ therefore, $\,\ (\color{#c00}{a,p^{n-m}})=1,\ $ again, $ $ by Euclid's Lemma.
Alternatively, employ the universal definition: $\rm\,\ gcd(\color{#0A0}{a,b}) = \color{#C00}d \ \ $ iff $\rm\ \ c\mid \color{#0A0}{a,b}\!\iff\! c\mid \color{#C00}d$
Notice, by unique factorization, $\rm\ \prod P_i^{J_i}\mid \prod P_i^{K_i}\iff J_i \le K_i.\:$ Therefore
$\rm \prod P_i^{J_i}\,\big|\, \color{#0A0}{\prod P_i^{K_i},\: \prod P_i^{L_i}} \iff J_i \le K_i,L_i \iff J_i\le min(K_i,L_i)\iff \prod P_i^{J_i}\,\big|\,\color{#C00}{\prod P_i^{min(K_i,L_i)}}$
Therefore, by the stated universal definition: $\rm\ gcd\left(\color{#0A0}{\prod P_i^{K_i},\: \prod P_i^{L_i}}\right) =\, \color{#C00}{\prod P_i^{min(K_i,L_i)}}$
Finally note that $\rm\ \prod P_i^{J_i}\:$ square $\,\Rightarrow$ $\rm \prod P_i^{J_i} = \left(\prod P_i^{K_i}\right)^2 = \prod P_i^{2 K_i}\: $ $\Rightarrow$ $\rm\:J_i\:$ even $ $ (and conversely), by unique factorization. Therefore $\rm\:J_i,K_i\:$ even $\,\Rightarrow$ $\rm\:min(J_i,K_i)\:$ even $\,\Rightarrow$ $\rm\:\prod P_i^{min(K_i,L_i)}\:$ square.