<s>[INST] Evaluate $\gcd(ab,p^4)$ and $\gcd(a+b,p^4)$, given that $\gcd(a,p^2)=p$ and $\gcd(b,p^3)=p^2$, where $p$ is a prime. Evaluate $\gcd(ab,p^4)$ and $\gcd(a+b,p^4)$, given  that $\gcd(a,p^2)=p$ and $\gcd(b,p^3)=p^2$, where $p$ is a prime. Is it true if $\gcd(a,b)=\gcd(a,c)$, then 
$\gcd(a^2,b^2)=\gcd(a^2,c^2)$?
We have $\gcd(a,p^2)=p\implies au_1+p^2v_1=p, u_1,v_1\in \mathbb Z\implies au_1p^2+p^4v_1=p^3\implies \gcd(a,p^4)=p^3 $   
$\gcd(b,p^3)=p^2\implies bu_2+p^3v_2=p^2, u_2,v_2\in \mathbb Z\implies bu_2p+p^4v_2=p^3\implies \gcd(b,p^4)=p^3$
 So $\gcd(ab, p^4)=p^3$. How to show next part? 
 [/INST] By assumption, we have that there exist $x,y,z,w\in\mathbb{Z}$ so that
$$
ax+p^2y=p\tag{1}
$$
and
$$
bz+p^3w=p^2\tag{2}
$$
Separating $ax$ and $bz$ and multiplying, then moving the multiple of $p^4$ back to the left, we get
$$
abxz+p^4(w+y-pwy)=p^3\tag{3}
$$
Thus, $\gcd(ab,p^4)\mid p^3$. However, since $p\mid a$ and $p^2\mid b$, $p^3\mid ab$. Therefore,
$$
\boxed{\displaystyle\bbox[5px]{\gcd(ab,p^4)=p^3}}\tag{4}
$$

Since $p^2\mid b$, we have $b=p^2u$, thus $(1)$ implies
$$
\begin{align}
\hspace{-1cm}1
&\hspace{-.7cm}=\left(\frac{a+b}px+p(y-u)\right)^3\\
&\hspace{-.7cm}=\frac{a+b}p\left[\left(\frac{a+b}p\right)^2x^3+3x^2(a+b)(y-u)+3xp^2(y-u)^2\right]+p^3(y-u)^3\\
\hspace{-1cm}p
&\hspace{-.7cm}=(a+b)\left[\left(\frac{a+b}p\right)^2x^3+3x^2(a+b)(y-u)+3xp^2(y-u)^2\right]+p^4(y-u)^3\tag{5}
\end{align}
$$
Thus, $\gcd(a+b,p^4)\mid p$, but since $p\mid a+b$, we have
$$
\boxed{\displaystyle\bbox[5px]{\gcd(a+b,p^4)=p}}\tag{6}
$$

Suppose that $\gcd(a,b)=\gcd(a,c)=d$. Then,
$$
\gcd\left(\frac ad,\frac bd\right)=\gcd\left(\frac ad,\frac cd\right)=1\tag{7}
$$
If $\gcd(a,b)=1$, then we have $x,y$ so that $ax+by=1$ and so
$$
\begin{align}
1
&=(ax+by)^3\\
&=a^2(ax^3+3bxy)+b^2(3axy^2+by^3)\tag{8}
\end{align}
$$
so $\gcd(a^2,b^2)=1$. Apply this to $(7)$ and multiply by $d^2$ to get
$$
\boxed{\displaystyle\bbox[5px]{\gcd(a^2,b^2)=\gcd(a^2,c^2)=d^2}}\tag{9}
$$
</s>