gcd and lcm from prime factorization proof How should I approach obvious proofs like these

I have been trying but couldn't find an elegant way to work these. Any help is highly appreciated ! Especially looking for a nice proof/hint for first problem
 A: Let $a=p_{1}^{a_{1}}\cdots p_{r}^{a_{r}}$ and $b=p_{1}^{b_{1}}\cdots p_{r}^{b_{r}}$; then it is easy to verify that $a\vert b \iff a_{i}\le b_{i}$ for $1\le i\le r$
using the Fundamental Theorem of Arithmetic.
$\textbf{1)}$ $\;\;$If $d\vert m$ and $d\vert n$, it follows that $d=p_{1}^{d_{1}}\cdots p_{r}^{d_{r}}$ with $d_{i}\le k_{i}$ and $d_{i}\le j_{i}$ for $1\le i\le r$, so $\hspace{3.6 in}$ $d_{i}\le\min(k_{i}, j_{i})$ for $1\le i\le r$.
Therefore $\gcd(m,n)=p_{1}^{u_{1}}\cdots p_{r}^{u_{r}}$ where $u_{i}=\min(k_{i},j_{i})$ for $1\le i\le r$.
$\textbf{2)}$ $\;\;$ If $m\vert l$ and $n\vert l$, it follows that
$l=p_{1}^{l_{1}}\cdots p_{r}^{l_{r}}p_{r+1}^{l_{r+1}}\cdots p_{s}^{l_{s}}$ with $k_{i}\le l_{i}$ and $j_{i}\le l_{i}$ for $1\le i\le r$, so
$\hspace{3.6 in}$ $l_{i}\ge\max(k_{i}, j_{i})$ for $1\le i\le r$.
Therefore ${\rm lcm}(m,n)=p_{1}^{v_{1}}\cdots p_{r}^{v_{r}}$ where $v_{i}=\max(k_{i},j_{i})$ for $1\le i\le r$.
A: Hint $ $ Assume $\,p\nmid a,b.\,$ Write $\ (x,y) := \gcd(x,y),\ \ [x,y] := { \rm lcm}(x,y)$. By uniqueness of prime factorizations, we can recursively compute gcd and lcm one-prime-power at at time as follows
$\ (ap^j,bp^k) = (a,b)\color{#c00}{(p^j,p^k)} = (a,b)\,\color{#0a0}{p^{\large \min(j,k)}}\,$ by $\, p^i\mid \color{#c00}{p^j,p^k} \iff i\le j,k \iff i\le \color{#0a0}{\min(j,k)}$
$\ \, [ap^j,bp^k] =\, [a,b]\,\color{#c00}{[p^j,p^k]}\, =\, [a,b]\,\color{#0a0}{p^{\large \max(j,k)}}$ by $\,  \color{#c00}{p^j,p^k}\mid p^i \iff j,k\le i \iff \color{#0a0}{\max(j,k)}\le i$
