# Prove that $5$ is the only prime $p$ such that $3p + 1$ is a perfect square

Prove that $5$ is the only prime $p$ such that $3p + 1$ is a perfect square.

I started off with assuming that $p$ is odd (since $2$ clearly does not satisfy). This would mean that $3p + 1$ is even. Since if a perfect square is even, it has to be divisible by four, it would mean that $4|3p + 1$.

If $p \equiv 1\pmod 4$, $3p + 1 \equiv 0\space \pmod 4$. All other possible residues of $p \pmod 4$ don't work out. This implies that our proof can be reduced to finding all $m$ such that $3(4m + 1) + 1 = (2n)^2$, or $3m + 1 = n^2$, which looks a lot like our first expression, except, here $m$ does not have to be a prime.

It just remains to be proven that the only $m$ such that $4m + 1$ is a prime and $3m + 1$ is a perfect square is $1$. I don't know where to go from here.

Hint: If $3p +1 = n^2$, then $(n-1)(n+1) = 3p$.
What does this tell you about $n$? Why is there only 1 solution?
• I got it. Since $(n-1)(n+1) = 3p$. One of them must equal $p$ and the other must equal $3$. If $n + 1$ = 3, then $n = 2$, and $n - 1 = 1$, but $1$ is not prime. If $n - 1 = 3$, then $n = 4$ and $n + 1 = p = 5$. – Gerard Aug 15 '13 at 6:41
• @Ananay Just being pedantic but it would also be necessary to check $(n-1)=1$ and $(n+1)=1$. However, these also yield no results. – Kieran Cooney Aug 15 '13 at 9:55