So I've been stuck on this proof for the past threes days now. I keep going back and forth and making no progress.
Let $n\in \mathbb{Z}_{\geq 2}$. Show that $\mathbb{Z}/n\mathbb{Z}$ has a nonzero nilpotent element iff there is a prime $p$ s.t. $p^2$ divides $n$.
$(\Rightarrow)$ I know $a$ can be factored into distinct primes, so $a=p_1^{e_1}\cdot ...\cdot p_m^{e_m}$ then $a^k=p_1^{e_1k}\cdot ...\cdot p_m^{e_mk}$.
Also since $n|a^k$ so $a^k=nd$ for some $d\in \mathbb{Z}$.
$a^k=p_1^{e_1k}\cdot ...\cdot p_m^{e_mk}=nd$. So $nd$ has that distinct prime factorization.
Then I get lost on what to do.
By the chinese remainder theorem $\mathbb Z/n\mathbb Z$ is the direct product of rings $\mathbb Z/p^k \mathbb Z$ where the primes and exponents appearing are those in the prime factorization of $n$.
Because operations now work coordinate wise, we can then assume that $n=p^k$ is a prime power. In such case, the result is quite simple: if $k=1$ then the ring is a field, and it admits no nontrivial nilpotent elements. If, on the other hand, $k>1$; then certainly $p$ is a nontrivial nilpotent element.
In general, if $A$ is a commutative ring, its nilradical $\mathfrak N(A)$ is the collection of nilpotent elements in $A$. It is in fact an ideal of $A$ by the binomial theorem, and it behaves well with direct product of (commutative) rings: if $A = A_1\times\cdots\times A_r$ then the nilradical of $A$ is the product of the nilradicals of the various $A_i$.
A ring whose nilradical is trivial is said to be reduced. It follows that if a ring is a direct product of other rings, then it is reduced if and only if each factor is reduced. That's what we have observed above.