Hint $ $ If $\ p\nmid a,b\ $ then $\ (p^m a, p^n b) = p^{\min(m,n)} (a,b).\, $ Recurse similarly on $\:\!(a,b):=\gcd(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: $\,\ \gcd(\color{#0A0}{a,b}) = \color{#C00}d \ \ $ iff $\ \ c\mid \color{#0A0}{a,b}\!\iff\! c\mid \color{#C00}d$
Notice, by unique factorization $\ \prod P_i^{J_i}\mid \prod P_i^{K_i}\!\!\iff\! J_i \le K_i.\:$ Therefore
$ \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 {\small \min}(K_i,L_i)\!\!\iff\!\! \prod P_i^{J_i}\,\big|\,\color{#C00}{\prod P_i^{{\small \min}(K_i,L_i)}}$
Therefore, by the stated universal definition: $\, \gcd\left(\color{#0A0}{\prod P_i^{K_i},\: \prod P_i^{L_i}}\right) =\, \color{#C00}{\prod P_i^{{\small \min}(K_i,L_i)}}$
Finally $\, \prod P_i^{J_i}$ square $\,\Rightarrow$ $ \prod P_i^{J_i} = \left(\prod P_i^{K_i}\right)^2\! = \prod P_i^{2 K_i} $ $\Rightarrow$ $\:J_i$ even $ $ (and conversely), by unique factorization. So $\,J_i,K_i\:$ even $\,\Rightarrow$ $\,{\small\min}(J_i,K_i)\,$ even $\,\Rightarrow$ $\:\prod P_i^{{\small\min}(K_i,L_i)}$ square.
Or we can prove $\,\gcd(a^2,b^2) = \gcd(a,b)^2\,$ by easy gcd arithmetic.