Recently I realized that the only PIDs I know how to write down that aren't fields are $\mathbb{Z}, F[x]$ for $F$ a field, integral closures of these in finite extensions of their fraction fields that happen to have trivial class group, localizations of these, and completions of localizations of these at a prime. Are there more exotic examples? Is there anything like a classification?
[Math] Exotic principal ideal domains
ac.commutative-algebraexamples
Related Solutions
I am also unsure of what "nontriviality" conditions you want to impose. Without any further conditions, the following answers your question:
Call a positive integer $n$ nilpotent if every group of order $n$ is nilpotent.
Call a positive integer $n$ abelian if every group of order $n$ is abelian.
Suppose that the prime factorization of $n$ is $p_1^{a_1} \cdots p_r^{a_r}$. Then:
$n$ is nilpotent iff for all $i,j,k$ with $1 \leq k \leq a_i$, $p_i^k \not \equiv 1 \pmod{p_j}$.
$n$ is abelian iff it is nilpotent and $a_i \leq 2$ for all $i$.
These results are proved in
Pakianathan, Jonathan(1-WI); Shankar, Krishnan(1-MI) Nilpotent numbers. Amer. Math. Monthly 107 (2000), no. 7, 631--634.
The proofs are constructive: for any $n$ which is not nilpotent (resp. abelian), they give an explicit group of that order which is not nilpotent (resp. abelian).
The paper is available at
Let $K$ be a complex quadratic number field such that $K(i)$ has class number $1$. If $K$ has class number $\ne 1$, then $K(i)$ must be the Hilbert class field of $K$, which, in this case, coincides with the genus class field of $K$. By genus theory, the discriminant of $K$ must have the form $d = -4p$ for a prime number $p \equiv 1 \bmod 4$.
In these cases, the ring of integers in $K$ is $R = {\mathbb Z}[\sqrt{-p}]$, and the ring of integers in $L$ is ${\mathbb Z}[i, (1 + \sqrt{p})/2] \ne R[i]$.
Finding number fields of higher degree with this property seems to be an interesting problem; I can't think of an obvious approach in general, but if I find anything, I'll let you know.
Edit 1. The argument works for all imaginary number fields: if $R$ is the ring of integers in a number field $K$, and if $S = R[i]$ is the ring of integers in the extension $L = K(i)$, then disc$(L) = \pm 4$ disc$(K)^2$ (this is a simple determinant calculation: take an integral basis $\{\alpha_1, \ldots, \alpha_n\}$ for $K$; then $\{\alpha_1, \ldots, \alpha_n, i\alpha_1, \ldots, i\alpha_n\}$ is an integral basis for $L$).
On the other hand, if $L$ has class number $1$ and $K$ is not a PID, then $K$ has class number $2$ and $L$ is the Hilbert class field of $K$. This implies disc$(L) = \pm$ disc$(K)^2$.
The problem in the non-imaginary case is that $K(i)$ might be unramified at all finite primes, but not at infinity; in this case, $K$ has class number $2$ in the strict sense, yet its ring of integers is a UFD.
Remark 2. By looking at $p = \alpha^2 + \beta^2$ modulo $4$ it follows (unless I did something stupid) that primes $p \equiv 3, 7 \bmod 20$ are not sums of two squares in ${\mathbb Z}[\sqrt{-5}]$.
Edit 2. Your suggestion to look at rings $R[\frac12]$, where $R$ is the ring of integers of a quadratic number field, seems to work for $K = {\mathbb Q}(\sqrt{-17})$, which has a cyclic class group of order $4$. The ring $R[\frac12]$ has class number $2$ because $2$ is ramified and so generates a class of order $2$, and $S = R[\frac12,i]$ is the integral closure of $R[\frac12]$ in the extension $L = K(i)$. The ring $R[\frac12]$ has class number $2$, and $S$ is a UFD since $L$ has class number $2$, and its class group is generated by one of the prime ideals above $2$ (the ramified prime above $2$ in $K$ splits in $L$).
Edit 3. The corollary concerning sums of two squares in $R[\frac12]$ shows that primes $p \equiv 3 \bmod 4$ splitting in $K$ are sums of two squares up to units. In fact it follows from genus theory that the prime ideals above such $p$ are not in the principal genus, hence lie in the same class as the prime above $2$ or in its inverse. This implies that either $2p = x^2 + 17y^2$ or $8p = x^2 + 17y^2$, giving a representation of $p$ as a sum of two squares up to a unit (remember $2$ is invertible). Thus everything is working fine.
Best Answer
No, to the best of my knowledge there is nothing like a general classification of PIDs. Despite their easy definition, they turn out to be rather a finicky class of rings, as for instance Gauss conjectured that there are infinitely many PIDs among rings of integers of real quadratic fields, but more than $200$ years later we have not been able to prove that there are infinitely many PIDs among rings of integers of all number fields. And, as came out in the comments to Emil's answer, the property of being a PID is not first order, so is not very robust in a model-theoretic sense. In that regard, the better class of rings are the Bézout domains, i.e., domains in which every finitely generated ideal is principal. A theorem of Kaplansky which can be used to show that various "big" domains (e.g. $\overline{\mathbb{Z}}$, the ring of all algebraic integers) are Bézout can be found at the end of the section on overrings in these notes. (I am now giving less precise citations to my often-changing commutative algebra notes in the hope that they will take longer to become obsolete.)
There are some interesting papers on construction of PIDs with various properties. The one I want to read next is this 1974 paper of Raymond C. Heitmann: given any countable collection $\mathcal{F}$ of countable fields containing only finitely many fields of any given positive characteristic, Heitmann constructs a countable PID of characteristic $0$ with residue fields precisely the elements of $\mathcal{F}$.
Added: note that $\overline{\mathbb{Z}}$ is also an antimatter domain, i.e., it has no irreducible elements (which specialists in the field tend to call "atoms"). Thus this gives an example of a Bézout domain which is not an ultraproduct of PIDs.