Squares, Cubes and Prime numbers

Solution 1:

Hint: if $p \equiv \pm 1 \mod 3$, then what is $p^2 + 2 \mod 3$? How many primes $p$ are there such that $p^2 + 2$ is also prime?