Find all primes p and q such that p^2 + 7pq + q^2 is the square of an integer?
The answer is not important. What is the approach to this problem?
First of all, with $\displaystyle q = p, p^2 + 7pq + q^2 = 9p^2 = (3p)^2$, so any prime would do.
So from now on lets assume $\displaystyle p\neq q$
Let $\displaystyle p^2 + 7pq + q^2 = x^2 = (p+q)^2 + 5pq \Rightarrow x^2 - (p+q)^2 = (x - p - q)(x+p+q)= 5pq$
Now since $\displaystyle 5,p,q$ are all primes, the factors of $\displaystyle 5pq$ are $\displaystyle 1,5pq,5p,5q,pq,p,q,5$
Observing that $\displaystyle x- p - q < x+p+q$, we have
1)$\displaystyle x-p-q = 1, x+p+q = 5pq \Rightarrow 2(p+q)+1 = 5pq \Rightarrow q = \frac{2p+1}{5p-2}$
Assume a solution exists. Now since q is a prime, $\displaystyle q > 1 \Rightarrow 2p+1 > 5p - 2 \Rightarrow p < 1$, which is not possible since we assumed p to be prime and hence p > 1. Thus no solution exists.
2)$\displaystyle x-p-q = q, x+p+q = 5p \Rightarrow 2p + 3q = 5p \Rightarrow q=p$
We have already solved this case.
3)$\displaystyle x-p-q = p, x+p+q = 5q \Rightarrow 3p + 2q = 5q \Rightarrow q=p$
Same as (2)
4)$\displaystyle x-p-q = 5, x+p+q = pq \Rightarrow 5 + 2(p + q) = pq \Rightarrow q = \frac{2p+5}{p-2} = 2 + \frac{9}{p-2}$
Since q is a natural number, (p-2)|9 and thus p-2 can be either 1,3 or 9.
So trying all cases,
1)$\displaystyle p-2=1 \Rightarrow p=3 \Rightarrow q = 2 + \frac{9}{p-2} = 11$
Thats
2)$\displaystyle p-2=3 \Rightarrow p=5 \Rightarrow q = 2 + \frac{9}{p-2} = 5 $
Its right but we already have tackled $\displaystyle p=q$ case.
3)$\displaystyle p-2=9 \Rightarrow p=11 \Rightarrow q = 2 + \frac{9}{p-2} = 3$
Thats again.
So the solutions are the following(note that w represents any arbitrary prime):
$\displaystyle (p,q) \in \{(w,w),(3,11),(11,3)\} $