Fall 2016, problem 19

Find all pairs of positive integers $(a,b)$ such that $a-b$ is a prime number and $ab$ is a perfect square.


5 years ago

If $gcd(a, b)> 1$, $a-b$ would be divisible by $gcd(a, b)$ and hence won't be a prime. It follows that $gcd(a, b) = 1$. Further, since $ab$ is a square and $a$ and $b$ are co-prime, they must individually be squares.

Let $a = d^2$ and $b = e^2$, where $d,e \in \mathbb{N}$. Then $a - b = (d - e)(d + e)$ and given that $a - b$ is prime, $d - e = 1 \implies d = 1 + e$.

Therefore, $a - b = 2e + 1 = p$, where $p$ is a prime. The pairs $(a, b)$ are $( \lbrack\frac{p-1}{2}\rbrack^2, \lbrack\frac{p+1}{2}\rbrack^2)$, where the prime $p$ is such that $p>2$.

Addendum: I missed the case that $gcd(a, b)$could also be the prime $p$. In this case, let $a = px$ and $b = py$. Then, $a - b = p (x - y)$. Since $a - b$ is prime, $x - y = 1 \implies y = x + 1$. Then, $ab = p^2 (x)(x + 1)$ cannot be a square since $x$ and $x + 1$ can't both be squares.

5 years ago

Suppose that $a$ and $b$ have a common prime factor $m$: $a=ms$ and $b=mt$.

As $a-b=m(s-t)=p$ (prime), then $s-t=1 (1)$. On the other hand, the perfect square $ab = m^2st$ and so $st$ is also a perfect square. From $(1)$ , $s$ and $t$ are consecutive integers, therefore $st$ is not a perfect square. Contradiction. Then $a$ and $b$ are coprimes, and consequently perfect squares, because $ab$ is a perfect square.

Let $a=u^2$ and $b=v^2$. $a-b=u^2-v^2=(u-v)(u+v)=p$. Then $u-v=1$ and $u+v=p$ and so $2v+1=p \iff v=\frac{p-1}{2}$.

Finally, $b= v^2=\frac{(p-1)^2}{4}$ and $a= u^2=(v+1)^2=\frac{(p+1)^2}{4}$, and $p$ an odd prime.

5 years ago

Equivalently, we have to find a prime number $p$ and natural numbers $a, b, c$, such that:

  • $a - b = p$ (Eq.1)
  • $a b = c^2$ (Eq.2)

You can immediately check, that one class of solutions are of the following form:

  • $p \neq 2$ any prime number
  • $a := \frac{1}{4} (p + 1)^2$
  • $b := \frac{1}{4} (p - 1)^2$
  • $c = \frac{1}{4^2} (p + 1)^2 (p-1)^2$

Note, that the values $a,b,c$ defined in such a way are indeed natural numbers, since the square of an even number is always divisible by 4 and we require $p$ to be odd. I claim, that all solutions are of this form.

First let's show, that there are no solutions with $p = 2$. Indeed, if $b (b + 2) = c^2$, then we would have $b^2 \lt c^2 \lt (b+2)^2$. Therefore $c^2 = (b+1)^2 = b (b+2)$. This implies the contradiction $2 b + 1 = 2b$.

So let us look at the solutions with $p$ an odd prime. Since $p = a - b$ is a multiple of gcd($a, b$) and $p$ is prime, either gcd$(a,b) = p$ or gcd$(a, b) = 1$. Let us exclude the former

  • Possibility $gcd(a, b) = p \implies$ $a$ and $b$ are multiples of $p$: Say $b = kp$ and so by (Eq.1) $a = (k+1)p $ for a natural number $k$. Then (Eq.2) tells us, that $k (k+1)$ is a square number. But there are no square numbers strictly between $k^2$ and $(k+1)^2$: A contradiction.

We know now, that gcd$(a,b)=1$, that is $a$ and $b$ are coprime: Then thinking about the prime factors on both sides of (Eq.2) tells us that each of $a$ and $b$ is already a square number. Say $a = u^2$ and $b = v^2$. From (Eq.1) we have: $$u^2 - v^2 = (u -v) (u+v) = p$$ The numbers $u -v$ and $u+v$ must be equal to $1$ and $p$ in some order, because $p$ is a prime. But $u + v = 1$ is excluded, since $u$ and $v$ are assumed positive. Therefore $u - v = 1$ and $u + v = p$, from which $u = \frac{1}{2} (p + 1) = \sqrt{a}$ and $v = \frac{1}{2} (p - 1) = \sqrt{b}.$


5 years ago

I think the answer is that (4,1) is the only pair.

2 weeks ago

If a and b are not perfect squares and ab is a perfect square, then gcd(a,b)>1, and a/gcd(a,b) and b/gcd(a,b) are perfect squares; then a-b=(a/gcd(a,b)-b/gcd(a,b))gcd(a,b), so because the squares of nonzero integers cannot differ by only 1, this means a-b is not prime.

This sort of argument is needed to explain why you should only consider the case where a and b themselves are perfect squares.

--> Tree Care Specialist