How many $n \in \mathbb{Z}$ such that the ideal $\langle n, x \rangle$ in $\mathbb{Z}{[x]}$ is a principal ideal?
This question came from abstract algebra olympiad in our state. The definition said that $I$ is a principal ideal if $I = \langle a \rangle$ for $a \in R$. But how to apply that definition here?
The ideal $I$ generated by $n$ and $x$ in $R=\mathbb{Z}[x]$ is exactly the set of polynomials $P\in R$ satisfying $n\mid P(0)$ (easy).
Assume it is generated by a polynomial $D$. Since $n,x\in I$, we have $D\mid n$ and $D\mid x$. The first divisibility relation shows that $D$ is a constant polynomial, the second one shows that this constant polynomial divides $x$. Hence $D$ equals $1$ or $-1$. But $D$ lies in $I$, so $D=D(0)$ is divisible by $n$. Therefore $n$ divides $\pm 1$, meaning that $n=1$ or $-1$.
Conversely, $\langle \pm 1,x\rangle=R$, which is principal.
Hence your ideal is principal if only if $n=\pm 1$.