mathschallenge.net logo

Prime Difference

Problem

Given that $a$ and $b$ are positive integers and the difference between the expressions $a^2 + b$ and $a + b^2$ is prime, find the values of $a$ and $b$.


Solution

Without loss of generality suppose that $a^2 + b \gt a + b^2$.

Now $p = (a^2 + b) - (a + b^2)$ can be written as $(a - b)(a + b - 1)$, and as this is prime then one of the factors must equal one.

As $a - b \lt a + b - 1$ we have $a - b = 1$ and $a + b - 1 = p$.

Adding both expressions gives $2a - 1 = p + 1 \implies a = \dfrac{p}{2} + 1$.

Clearly $p$ cannot be odd. Hence there is a unique solution when $p = 2$, for which $a = 2$ and $b = 1$.

Prove that $(a^2 + b) - (a + b^2)$ is always even.

Problem ID: 322 (14 Apr 2007)     Difficulty: 3 Star

Only Show Problem