A problem from a university exam paper.
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$
This site has solved this problem once. But I have a specific question in my approach. This problem that I have found in some exam paper doesn't say that $p$ is prime. It looks like prime but is it obvious that $p$ must be prime?
Anyway, here is my workout.
$$\gcd(a,p^2)=p, \space\space \gcd(b,p^3)=p^2$$
We have $p$ that $p\mid a,\space p \mid p^2$. Again $p^2\mid b, \space\space p^2\mid p^3$.
Now $$p^2\mid b, \space\space p^2\mid p^3, \space\space p \mid p^2 \\ \therefore p\mid p^3\\p\mid b\\\therefore p\mid a,\space p \mid p^2,\space\space p \mid b,\space\space p \mid p^3\\ \therefore p\mid a+b$$.
Here $$\because p\mid a,\space p \mid p^2,\space\space p \mid b,\space\space p \mid p^3,\space\space p^2\mid p^3,\space\space p^2\mid b\\\space\space \\\text{and} \space\space \gcd(a,p^2)=p,\space\space \gcd(b,p^3)=p^2$$.
Hence is it correct to choose $a=p$ and $b=p^2$? If it is correct then $$\gcd(a+b,p^4)=\gcd(p+p^2,p^4)=p\\ \text{and}\space\space \gcd(ab,p^4)=\gcd(p\cdot p^2,p^4)=\gcd(p^3,p^4)=p^3$$
If choosing $a=p$ and $b=p^2$ is not correct please provide or suggest the correct way. Any help or suggestion is greatly appreciated.