TITLE: question on prime number
QUESTION [6 upvotes]: Just came across the following question:

Suppose $p$ is a prime number and $p+1$ is a perfect square. Find the sum of all such prime numbers.

This is simple and  there is a unique $p$, namely $p=3$.
Now I come to my question:

Suppose $p$ is a prime number and $p+2$ is a perfect square. Are there are infinitely many of such primes $p$? 

Or in general, 

Is there a way to determine if there are infinitely many of prime numbers $p$ such that $p+a=k^2$ for some positive integers $a$ and $k$.

Edit:
For the special case that $p$ is a prime number and that $p+b^2$ is a perfect square, one can prove that there is a unique solution if $2b+1$ is prime, or else there is no solution.

REPLY [8 votes]: You are asking whether the polynomial $n^2 - 2$ represents infinitely many prime numbers (i.e. whether there are infinitely many integers $n$ such that $n^2 - 2$ is prime).  This is a particular case of Bunyakovsky's conjecture, and is believed to be true, but is not known (and is probably very difficult).