# Counting monic polynomials over $\mathbb{Z}_{p^k}$ with at least $2$ distinct roots

At one point in the course of working on something I was obliged to count the number of monic polynomials of degree $n$ over $\mathbb{Z}_p$ having at least two distinct roots (as usual, $p$ is a prime).

This isn't hard -- given such a polynomial $p(x)$, I can write $p(x) = (x-a)(x-b)q(x)$, where $a,b \in \mathbb{Z}_p$ are distinct and $q(x)$ is a monic polynomial of degree $n-2$. I have $\binom{p}{2}$ choices for $a$ and $b$ and $p^{n-2}$ choices for $q(x)$, so the total number of these polynomials is $\binom{p}{2}p^{n-2}$.

Out of curiosity, I turned my attention to $\mathbb{Z}_{p^k}$. Through examples, it looks like the number of monic polynomials of degree $n$ over $\mathbb{Z}_{p^k}$ having at least two distinct roots is $\binom{p}{2}kp^{kn-2}$ -- but how does one prove this?

• I have trouble with the prime part. Let $p=n=3$. There are $7$ monic polynomials with at least two distinct roots modulo $p$. Your formula gives $9$, because it triple counts $x(x-1)(x-2)$. – André Nicolas Sep 26 '15 at 22:21
• ... and I have troubles with the fact that $\mathbb{Z}_{p^k}[x]$ is not an integral domain. – Jack D'Aurizio Sep 26 '15 at 22:37