# prime numbers and Pythagorean triplets

What are the necessary conditions for two of the terms in the Pythagorean triplet $a^2 = b^2 + c^2$ to be prime numbers?

There is a well-known parametrization of Phythagorean triples as $k(m^2 - n^2)$, $2kmn$ , $k(m^2 + n^2)$ with positive integers $k,m,n$ and $m$ greater $n$.
Now, if two are prime we get $k=1$. And also the middle term is never prime. So the question is when are $m^2 - n^2$ and $m^2 + n^2$ both prime. The former factors as $(m-n) (m+n)$. For this to be prime we need $m-n = 1$.
So we get two of three are prime if and only if $2n+1$ and $2n^2 + 2n + 1$ are prime for some positive integer $n$.
• Also, letting $p=2n+1$ we find that $2n^2+2n+1=\frac{p^2+1}{2}$. So you're basically looking for odd primes $p$ such that $\frac{p^2+1}{2}$ is also prime. – Faisal Oct 5 '11 at 15:52