TITLE: prime numbers and Pythagorean triplets
QUESTION [8 upvotes]: What are the necessary conditions for two of the terms in the Pythagorean triplet $a^2 = b^2 + c^2$ to be prime numbers?

REPLY [20 votes]: 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$.