# Find the prime numbers that satisfy the following condition

You've got 2 prime numbers p and q.

The difference of p^2 - q^2 is also a prime number.

Can you now know for sure which prime number p and q is? Explain which possibilities there are for p and q, and why this are the only possibilities.

The only thing I could find was

p=3 and q=2

3^2 - 2^2 = 5 which is also a prime number.

But I dont know how to prove they are the only options (if they are).

• Do you know an other way to write $p^2-q^2$? – Balloon Oct 29 '18 at 16:37
• What do you mean? Do you mean like (pp)-(qq)=x – Anton Svarén Oct 29 '18 at 16:40
• That rewriting it is the key to prove that you have no other choices of $p,q$. – Balloon Oct 29 '18 at 16:43
• All primes except 2 and 3 take the form of $6n \pm1$. Also, the square of any prime greater than 3 is one greater than a multiple of 24. (If p is prime, $\frac{p^2-1}{24}$ is an integer.) These two factors may explain why only 2 and 3 work for you. – poetasis Oct 29 '18 at 16:55

You can factor to obtain $$p^2-q^2 = (p-q)(p+q)$$. This is prime if and only if one of the two factors is equal to one. Since $$p$$, $$q>0$$ we must have that $$p = q+1$$. Now, suppose towards contradiction if $$p^2-q^2$$ were prime, with $$p>3$$. Then either $$p$$ or $$q$$ is even and greater than $$2$$. But then $$p$$ or $$q$$ isn't prime, which is a contradiction.
Thus the only pairs of numbers left as candidates are $$(3,2)$$ and $$(2,1)$$, but one isn't prime, which completes the proof after checking that $$(3,2)$$ satisfy the criteria.
$$p^2- q^2 = (p-q)(p+q)$$. So if the former is a prime, $$p-q$$ must be $$1$$ and $$p+q = p^2 -q^2$$. Two primes that differ by $$1$$ is quite rare...