Let p be an odd prime. Compute the number of irreducible polynomials of the form $f(x) = x^2 + x + a$ over $\mathbb{Z}_p$
I know there are $p$ total possibilities for that polynomial and that a degree 2 polynomial is reducible in $\mathbb{Z}_p$ iff it has a root in $\mathbb{Z}_p$ and for $f$ to be reducible that would mean it is of the form $f(x) = (x-b)(x-c)$ where $b,c \in \mathbb{Z}_p$. Mulptiplying these out yields $x^2 + (-b-c)x + bc$ so we need $bc=a$ and $b+c=-1=p-1$. How do I count the number of possible values for $b$ and $c$? I think the number of possible combinations for $b$ and $c$ to meet the condition $b+c=-1$ is $p$ (not sure though), but I can't figure out which of those $p$ choices will yield $bc=a$
$x^2+x+a$ is irreducible over $\mathbb{F}_p$ iff its discriminant $1-4a$ is a quadratic non-residue $\!\!\pmod{p}$.
There are $\color{blue}{\frac{p-1}{2}}$ quadratic non-residues and $4$ is invertible $\!\!\pmod{p}$ since $p$ is odd.