[example: Ideals in $\mathbb{Z}$]
Fix $n\in\mathbb{N}$. The set $n\mathbb{Z}=\{nk:k\in\mathbb{Z}\}$ contains $0=n\cdot 0$. If $a,b\in n\mathbb{Z}$, then $a=nm$ and $b=n\ell$ for some $m,\ell\in\mathbb{Z}$, so
\begin{align*}
a-b=nm-n\ell=n(m-\ell).
\end{align*}
Since $m-\ell\in\mathbb{Z}$, this shows $a-b\in n\mathbb{Z}$. If $r\in\mathbb{Z}$ and $a=nm\in n\mathbb{Z}$, then
\begin{align*}
ra=r(nm)=n(rm).
\end{align*}
Since $rm\in\mathbb{Z}$, this shows $ra\in n\mathbb{Z}$. Thus $n\mathbb{Z}$ is an ideal of $\mathbb{Z}$.
Conversely, let $I\trianglelefteq\mathbb{Z}$. If $I=\{0\}$, then $I=0\mathbb{Z}$. Otherwise $I$ contains a nonzero integer $t$. If $t<0$, then $-t\in I$ because $I$ is an additive subgroup, so $I$ contains a positive integer. Let $n$ be the least positive integer in $I$. Since $n\in I$ and $I$ absorbs multiplication by every integer, every element $qn$ with $q\in\mathbb{Z}$ lies in $I$, so $n\mathbb{Z}\subset I$.
For the reverse inclusion, take $x\in I$. By the [division algorithm](/theorems/725), write
\begin{align*}
x=qn+s
\end{align*}
with $q\in\mathbb{Z}$ and $0\leq s<n$. Since $x\in I$ and $qn\in I$, the additive subgroup property gives
\begin{align*}
s=x-qn\in I.
\end{align*}
If $s>0$, then $s$ is a positive element of $I$ smaller than $n$, contradicting the choice of $n$. Hence $s=0$, so $x=qn\in n\mathbb{Z}$. Therefore $I\subset n\mathbb{Z}$, and $I=n\mathbb{Z}$.
The generator is unique in $\mathbb{N}\cup\{0\}$: if $n\mathbb{Z}=m\mathbb{Z}$ with $n,m\geq 0$, then either both ideals are $\{0\}$, giving $n=m=0$, or both contain positive integers and their least positive elements must be equal. Thus every ideal of $\mathbb{Z}$ is exactly one of the ideals $n\mathbb{Z}$ with $n\in\mathbb{N}\cup\{0\}$.
[/example]