How can I find the number of primes of the form $|n^2 - 6n + 5|$ where $n$ is an integer? Through trial and error, I have found $n = 6$ (this one is obvious), and $2$. Are there any more, and what is a smarter way to solve this question?
The first thing I did when I saw your question was compute about a dozen values for small $n$ and look them up in the OEIS, which gave me A028347 and the formula $n^2 - 4$. Clearly for $n^2 - 4$ to be prime you need $n$ to be odd. Slightly less obvious, you need for $n$ to be a multiple of 3, because otherwise $n^2 \equiv 1 \pmod 3$. These conditions are necessary but not sufficient.
Digging a little further, we find that $n^2 - 4 = (n - 2)(n + 2)$: this is clearest when the formula gives you semiprimes with prime factors 4 apart, e.g., $19 \times 23$, $37 \times 41$, $43 \times 47$.
So you have found all the prime values already.