# For which values of $d<0$ , is the subring of quadratic integers of $\mathbb Q$ is a PID?

The “integers” of quadratic field $\mathbb Q[\sqrt{d}]$ , for a squarefree integer $d$ , forms an integral domain . I know that for $d<0$ , the quadratic integers of the quadratic number fields satisfy Euclidean algorithm only for $d=-1,-2,-3,-7,-11$ . I want to know , for which $d<0$ , it is true that every ideal of the integral domain of quadratic integers of $\mathbb Q[\sqrt{d}]$ is a principal ideal , that is when is the subring of quadratic integers of imaginary quadratic number fields is a PID ? I want to know this as PID do not imply ED but does imply UFD . Please help . Thanks in advance

#### Solutions Collecting From Web of "For which values of $d<0$ , is the subring of quadratic integers of $\mathbb Q$ is a PID?"

With $d<0$, the ring of integers of $\mathbb Q(\sqrt d)$ is a PID exactly when
$$d= −1, −2, −3, −7, −11, −19, −43, −67, −163$$
Checking that these rings are PIDs is not too hard, but checking that no other values give an integer ring that is a PID requires some heavy machinery – see the class number 1 problem.

The $d < 0$ such that $\mathcal{O}_{\mathbb{Q}(\sqrt{d})}$ is a principal ideal domain are: $$-1, -2, -3, -7, -11, -19, -43, -67, -163.$$ Multiplied by
$-1$, these are the Heegner numbers (see Sloane’s A003173).

If $\mathcal{O}_{\mathbb{Q}(\sqrt{d})}$ is a Euclidean domain, then it is also a principal ideal domain, and if it is a principal ideal domain, it is also a unique factorization domain. But it can be non-Euclidean and still be a principal ideal domain. For example, $\mathcal{O}_{\mathbb{Q}(\sqrt{-19})}$ is not Euclidean: try for example to compute $$\gcd\left(\frac{3}{2} + \frac{\sqrt{-19}}{2}, 10\right)$$ using the Euclidean algorithm. Frustrating, right? But it is a principal ideal domain.

Sloane tells us Gauss discovered the nine $d$ listed above (and also listed in other answers to your question) but “Heegner proved the list is complete.” Well, he had a little help from Tony Stark. The proof exists, has been published and has been verified. But it’s too long to include here.

I can at least show you why $-2$ is the only even value. Suppose $n$ is positive, odd and squarefree. Then, in $\mathbb{Z}[\sqrt{-2n}]$, we can be sure the following numbers are irreducible: 2, $n$, $\sqrt{-2n}$. So $2n$ has at least two factorizations: $2n = (-1)(\sqrt{-2n})^2$. Therefore the prime ideal that properly contains $\langle 2 \rangle$ and $\langle n \rangle$ can’t be a principal ideal.