Nilpotent elements in $\mathbb{Z}_n$ 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.
I have figured out the proof of showing that if $n$ is divisible by the square of a prime, then there is a nonzero nilpotent element. I'm having trouble with the other direction.
Start:
If there exists a nonzero nilpotent element $a$, then $n$ does not divide $a$, but $n$ divides $a^k$ for some positive integer $k$....Hint?
 A: Saying $n \mid a^k$ implies that $\{$ prime divisors of n $\} \subset \{$ prime divisors of $a^k\} = \{$ prime divisors of a $\}$
Assume now that $n$ has only simple prime divisors, and wonder if it is actually possible that $n \mid a^k$ without $n \mid a$ holding
A: Let $p$ be a prime that divides $n$. Then $p\mid a^k$, hence $p\mid a$. If $p_1, \ldots,p_m$ are the prime divisors of $n$, this implies $p_1p_2\cdots p_m\mid a$. If $n$ is squarefree this divisor is $n$ itself.
A: To be found is a positive integer $a<n$ such that $n$ divides $a^k$ for some positive integer $k$. If $n=p_1^{m_1}\cdots p_s^{m_s}$ with $p_i$ prime and $m_i$ positive then $a$ must be divisible by $p_1^{m'_1}\cdots p_s^{m'_s}$ where $0<m'_i\leq m_i$ and $m'_s+\cdots +m'_s<m_s+\cdots +m_s$ (this because $a<n$). That is impossible if $m_i=1$ for each $i$.
A: 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.
