Find my two numbers:

  1. Both are positive integers.
  2. Their difference is a prime.
  3. Their product is a perfect square.
  4. Their sum's last digit is 3.

Bonus: Can you show how many solutions exist?


1 Answer 1


4 and 9

Proving uniqueness:

Any mutual prime factor of the numbers is a prime factor of their difference, which is a prime. So, their GCD is either 1 or that prime $p$. So, in order for their product to be a perfect square, they must have the form $(x^2,y^2)$ or $(p x^2,p y^2)$, with $x$ and $y$ relatively prime. Then, their prime difference is $(y+x)(y-x)$ or $p(y+x)(y-x)$. The second case cannot be prime because $y+x \geq 2 $ and $p$ are nontrivial factors, whereas the first case must have $y-x=1$ (assuming WLOG $y \geq x$).

So, we need only consider pairs of the form $(x^2,(x+1)^2)$. We know their sum ends in a $3$ and so is $3$ mod $5$. This is only true for $x=2$ mod $5$. But, then, the prime difference $2x+1$ is a multiple of $5$, which implies that it must be $5$. This gives $x=2$, so $(4,9)$ is the unique solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.