what prime numbers can be written as the sum of two consecutive squares? title. I Tried using Gaussian integers but it got me nowhere. I'm not even sure a 'nice' characterization is possible.
 A: Basically, we are looking for primes $p=n^2 + (n+1)^2$ according to Wojowu. But primes, except the first two, are either of the form $p=6k+1$ or $p=6k-1$.
So we are looking for solutions of $2n^2 + 2n + 1 = 6k-1$ and $2n^2 +2n +1 = 6k+1$. So the problem is now reduced to solving a quadratic equation in $n$ with a parameter $k$. We demand that the discriminant $d$ of these quadratic equations be a square.
The case of $p=6k-1$ has a $d=12k-3$. $d$ is a square for $k=1,7,19,...$ and the corresponding primes are $p=5=1^2 + 2^2$, $p=41=4^2 + 5^2$ and $p=113=7^2 +8^2$. Most probably, not all square values of d will lead to a prime.
The case of $p=6k+1$ has a $d=12k+1$. $d$ is a square for $k=2,10,30,52...$ and the primes are $p=13= 2^2 + 3^2$, $p=61=5^2 + 6^2$, $p=181=9^2 + 10^2$, $p=313=12^2 +13^2$. 
It would be nice if someone could write a program (I cannot) to look for more $k$ values that lead to primes. By the way, the first two primes cannot be written as a sum of two consecutive primes.
