Determine all pairs $(p,q)$ of prime numbers for which $p^2+5pq+4q^2$ is a perfect square.
Problem
Source: Stars of Mathematics 2023 P1 (junior level)
Tags: number theory, prime numbers, Perfect Squares
26.11.2023 23:45
Completing the square yields $(p+2q)^2+pq=m^2 \implies pq=m^2-(p+2q)^2 \implies pq=(m-p-2q)(m+p+2q)$. WLOG $p \geq q$, then $p=m+p+2q \implies m+2q=0$. Since $q>0 \implies m<0$. Also, $q=m-p-2q \implies 3q=m-p$. Since $p>0$ and $m<0$, then $3q<0$ or $q<0$ which means $q$ is not prime. But $q$ must be prime so there are no solutions.
27.11.2023 00:00
Let $p^2+5pq+4q^2=k^2$ for $k\in\mathbb{N}$. Then, \[ (p+2q)^2 + pq = k^2 \Rightarrow (k-p-2q)(k+p+2q)=pq. \]Now that $k+p+2q>\max\{p,q\}$, we must have $k-p-2q=1$ and $k+p+2q=pq$. So, $k=p+2q+1$, yielding $2p+4q+1=pq$, that is $(p-4)(q-2)=9$. From here, we obtain $(p,q)=(5,11),(7,5),(13,3)$ as the only solutions.
27.11.2023 00:09
OHHHHH i forgot the other case im kinda goofy
27.11.2023 12:21
Assume $p,q\ne 2$. $(p+4q)(p+q)$ is a square so if $p\ne q$ then $p+4q=a^2,p+q=b^2\Rightarrow a^2-b^2=3q\Rightarrow (a-b)(a+b)=3q\Rightarrow a-b=1,a+b=3q$ or $a-b=3,a+b=q$. If $a-b=1,a+b=3q: a=\frac{3q+1}2\Rightarrow p+4q=\left(\frac{3q+1}2\right)^2\Rightarrow 4p+16q=9q^2+6q+1\Rightarrow 4p=9q^2-10q+1=(9q-1)(q-1)$ which gives solutions $(5,11),(7,5),(13,3)$.