# Let $p$ be a prime. Suppose that $\gcd(a, b) = p$. Find $\gcd(a^2,b)$ for all integers $a$ and $b$.

Let $p$ be a prime. Suppose that $\gcd(a, b) = p$. Find $\gcd(a^2,b)$ for all integers a and b.

I was able to prove that $\gcd(a^2,b^2) = p$ but I don't know if it helps.

Any help is greatly appreciated.

• Surely $\gcd (a^2,b^2)=p^2$.
– lulu
May 30 '17 at 22:09

It depends:

If $p^2 \mid b$ then $\gcd (a^2,b)=p^2$

If $p^2 \nmid b$ then $\gcd(a^2,b)=p$

Given that $\gcd(a,b)=p$ and $p$ is a prime, clearly $a$ and $b$ share no prime factors except for a single $p$. So, squaring $a$ does not result in any further shared prime factors, except for possibly a second $p$, but that is only if $p^2 \mid b$.

Another way to restate Bram's answer is to say that $p\mid \gcd(a^2,b)\mid p^2$.

More generally, if $\gcd(a,b)=d$, then $d\mid \gcd(a^2,b)\mid d^2$.

The fact that $d\mid \gcd(a^2,b)$ is easy to see, so we'll just show that $\gcd(a^2,b)\mid d^2$.

Solve $ax+by=d$. Squaring this, we see that $a^2x^2+b(2axy+by^2)=d^2$. This means that $\gcd(a^2,b)\mid d^2$.