Question: "I'm trying to show that $\mathbb{Z}_n$ has a nonzero nilpotent element if and only if n is divisible by the square of some prime."
Answer: Using the chinese remaider lemma you get a general formula for the nilradical $nil(\mathbb{Z}/n\mathbb{Z})$ for any integer $n$ as follows:
In general if $n:=p_1^{l_1}\cdots p_d^{l_d}$ with $p_i\neq p_j$ primes for all $i\neq j$, and $l_i\geq 2$ for some $i$, the ring $R:=\mathbb{Z}/n\mathbb{Z}$ will have non-trivial nilpotent elements. The nilradical in $R$ will be the ideal
$$ nil(R):=((p_1),..,(p_d))$$
in the crl-decomposition
$$R \cong \mathbb{Z}/(p_1^{l_1}) \mathbb{Z} \oplus \cdots \oplus \mathbb{Z}/(p_d^{l_d}) \mathbb{Z}$$
and $nil(R)$ will be nontrivial if $l_i\geq 2$ for some $i$. Define
$$\mathfrak{m}_i:=((1),..,(p_i),..,(1)) \subseteq B$$
it follows $\mathfrak{m}_i$ for $i=1,..,d$ are the maximal ideals of $R$. These are coprime ideals and it follows
$$nil(R)= \cap \mathfrak{m}_i=\prod \mathfrak{m}_i=((p_1),..,(p_d)).$$
If $l_i=1$ for all $i$, it follows $R$ is a product of fields which is a reduced ring.