This site is supported by donations to The OEIS Foundation.

Please do not rely on any information it contains.

Given a discriminant ${\displaystyle \scriptstyle D\,}$ being a squarefree integer, ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$[1] is the quadratic integer ring (contained in the quadratic number field ${\displaystyle \scriptstyle \mathbb {Q} ({\sqrt {D}})\,}$) of the form

${\displaystyle \mathbb {Q} [{\sqrt {D}}]:={\mathcal {O}}({\sqrt {D}}):={\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}:={\begin{cases}\{a+b{\sqrt {D}}\mid a,b\in \mathbb {Z} \}&{\text{if }}D\not \equiv 1{\pmod {4}},\\\\\{{\frac {a+b{\sqrt {D}}}{2}}\mid a,b\in \mathbb {Z} ,a\equiv b{\pmod {2}}\}&{\text{if }}D\equiv 1{\pmod {4}}.\end{cases}}}$

When ${\displaystyle \scriptstyle b\,=\,0\,}$, the result corresponds to an ordinary integer, though its factorization in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ might be different from its factorization in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. What's more, it may have multiple factorizations (in which case we say that ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ is not a unique factorization domain). When ${\displaystyle \scriptstyle b\,\neq \,0\,}$ the numbers may be irrational but they are nevertheless quadratic integers, and thus algebraic integers.

When ${\displaystyle D\equiv 1\mod 4}$, numbers of the form ${\displaystyle {\tfrac {a}{2}}+{\tfrac {b{\sqrt {D}}}{2}}}$ are algebraic integers when ${\displaystyle a}$ and ${\displaystyle b}$ have the same parity. For example, ${\displaystyle {\tfrac {3+5{\sqrt {5}}}{2}}}$ is an algebraic integer having a norm of 29. In these cases we use the notation ${\displaystyle \mathbb {Z} [{\tfrac {1+{\sqrt {D}}}{2}}]}$ rather than ${\displaystyle \mathbb {Z} [{\sqrt {D}}]}$, but one will occasionally encounter the latter when the former is meant. In the case of ${\displaystyle D=-3}$, the notation ${\displaystyle \omega =-{\tfrac {1}{2}}+{\tfrac {\sqrt {-3}}{2}}}$ has become widely accepted, and consequently the notation ${\displaystyle \mathbb {Z} [\omega ]}$ for the ring that includes ${\displaystyle {\sqrt {-3}}}$.

If ${\displaystyle \scriptstyle D\,<\,0\,}$ then ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ is called an imaginary quadratic integer ring, though it contains purely real and complex numbers as well as purely imaginary numbers. Otherwise, it is a real quadratic integer ring and contains only real numbers.

## Units in quadratic integer rings

1 and –1 are always units in a quadratic integer ring regardless of the discriminant. Some imaginary quadratic integer rings have more units (they are complex roots of unity), while all real quadratic integer rings have infinitely many units. The associates of a number in a quadratic integer ring are the products of that number by each of the units. In giving the factorization of many numbers from a quadratic integer ring, it often becomes necessary to include a unit.

Theorem I1. Given a positive and squarefree discriminant ${\displaystyle \scriptstyle D\,}$, the imaginary quadratic integer ring ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-D}})}\,}$ has a (small) finite set of units.

Proof. The norm of an algebraic integer in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-D}})}\,}$ is ${\displaystyle \scriptstyle a^{2}-(-D)b^{2}\,}$, which works out to ${\displaystyle \scriptstyle a^{2}+Db^{2}\,}$, meaning that the norm is never negative. This means that for ${\displaystyle \scriptstyle a+b{\sqrt {-D}}\,}$ to be a unit in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-D}})}\,}$, its norm has to be 1. Clearly 1 and –1 meet this requirement (${\displaystyle \scriptstyle b\,=\,0\,}$ then), while any other purely real integers don't, since ${\displaystyle \scriptstyle N(a)\,>\,1\,}$. If ${\displaystyle \scriptstyle b\,\neq \,0\,}$ and ${\displaystyle \scriptstyle D\,>\,4\,}$, then ${\displaystyle \scriptstyle N(a+b{\sqrt {-D}})\,\geq \,2\,>\,1\,}$, thus proving that 1 and –1 are the only units in each imaginary field other than ${\displaystyle \scriptstyle \mathbb {Z} [(1+{\sqrt {-3}}/2]\,}$, ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {-2}}]\,}$ and ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$, which we may now dispose of by examination one-by-one. In ${\displaystyle \scriptstyle \mathbb {Z} [(1+{\sqrt {-3}})/2]\,}$, we need to solve ${\displaystyle \scriptstyle a^{2}+3b^{2}\,=\,1\,}$ to find the units. The only solutions in integers are ${\displaystyle \scriptstyle a=\pm 1\,}$ with ${\displaystyle \scriptstyle b\,=\,0\,}$. There are four more solutions: ${\displaystyle \scriptstyle a=\pm 1/2\,}$ with ${\displaystyle \scriptstyle b\,=\,\pm 1/2\,}$. There are no more solutions since they would have ${\displaystyle \scriptstyle |a|>1}$ or ${\displaystyle \scriptstyle |b|>1}$, which is impossible. In ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {-2}}]\,}$ we have ${\displaystyle \scriptstyle a^{2}+2b^{2}\,=\,1\,}$ with the only answers being ${\displaystyle \scriptstyle a=\pm 1\,}$ with ${\displaystyle \scriptstyle b\,=\,0\,}$. In ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$, or ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {-1}}]\,}$, we have ${\displaystyle \scriptstyle a^{2}+b^{2}=1}$ because of the simplification ${\displaystyle \scriptstyle N(a+bi)\,=\,a^{2}+b^{2}\,}$. Either ${\displaystyle \scriptstyle a\,}$ or ${\displaystyle \scriptstyle b\,}$ must be 0 so that the other can be 1 or –1 and square to 1 either way. Therefore the units in ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$ form the small, finite set consisting of 1, –1, ${\displaystyle \scriptstyle i\,}$ and ${\displaystyle \scriptstyle -i\,}$. This proves all imaginary quadratic fields have a small finite set of units. □

Lemma R1a. Given nonzero integers ${\displaystyle a}$, ${\displaystyle b}$, ${\displaystyle d}$, with that last one positive and squarefree, the equation ${\displaystyle |a^{2}-db^{2}|=1}$ always has a solution.

Proof. PROOF GOES HERE. □[2]

Theorem R1. Given a positive and squarefree discriminant ${\displaystyle \scriptstyle d\,}$, the real quadratic integer ring ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ has infinitely many units.

Proof. –1 is a unit in any real quadratic field since –1 * –1 = 1. Remember the usual formula for the norm: ${\displaystyle \scriptstyle N(a+b{\sqrt {D}})\,=\,a^{2}-Db^{2}\,}$, which gives negative values if ${\displaystyle \scriptstyle Db^{2}\,>\,a^{2}\,}$. Find a solution to ${\displaystyle \scriptstyle a^{2}\,=\,Db^{2}-1}$ by using the following method FILL IN THAT METHOD ANOTHER DAY[3]. This solution gives us one more unit in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$: ${\displaystyle \scriptstyle a+b{\sqrt {D}}\,}$. Choose any ${\displaystyle \scriptstyle n\,\in \,\mathbb {Z} \,}$ and compute ${\displaystyle \scriptstyle (a+b{\sqrt {D}})^{n}\,}$. I BIT OFF MORE THAN I COULD CHEW ON THAT ONE, MISSING STEP HERE IS TO SHOW THE FORM OF (a + b sqrt(D))^n TO BE FILLED IN HERE[4]. If ${\displaystyle \scriptstyle n\,=\,0\,}$, then ${\displaystyle \scriptstyle (a+b{\sqrt {D}})^{n}\,=\,1\,}$, while ${\displaystyle \scriptstyle n\,=\,1\,}$, then ${\displaystyle \scriptstyle (a+b{\sqrt {D}})^{n}\,=\,a+b{\sqrt {D}}\,}$. Larger ${\displaystyle \scriptstyle n\,}$ give the SPECIFIED FORM[5], these numbers are larger but their norms still work out to –1 and are therefore units. Similarly, ${\displaystyle \scriptstyle (a+b{\sqrt {D}})^{-n}\,=\,{\frac {1}{(a+b{\sqrt {D}})^{n}}}\,}$; these numbers are smaller than 1 but they are distinct. Since ${\displaystyle \scriptstyle \mathbb {Z} \,}$ is an infinite set, the set of units in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ is the infinite set of values of ${\displaystyle \scriptstyle (a+b{\sqrt {D}})^{n}\,}$, proving the theorem. □

## Primes in quadratic integer rings

Neither the multitude of units in a real field nor the presence of imaginary numbers in imaginary fields pose any substantial problems to figuring out the potentially different prime factorizations of ordinary integers in those rings. The lack of unique factorization is a major obstacle in those fields with a class number other than 1. If ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ is a UFD, then knowledge of a few basic facts makes factorization of ordinary integers a very straightforward process.

In this article, we will consider numbers like –3 and –127 to be prime in ${\displaystyle \mathbb {Z} }$, as they are the product of a positive prime and the unit –1.

Theorem P0. If a prime ${\displaystyle p}$ in ${\displaystyle \mathbb {Z} }$ is the norm of an integer ${\displaystyle a+b{\sqrt {D}}}$, with ${\displaystyle b\neq 0}$, then ${\displaystyle a+b{\sqrt {D}}}$ is prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$.[6]

Proof. Remember that norms are always integers from ${\displaystyle \mathbb {Z} }$, and that the norm is a multiplicative function. If ${\displaystyle a+b{\sqrt {D}}}$ was composite, we could choose integers ${\displaystyle s}$ and ${\displaystyle t}$ from ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$, neither of them units in that field, such that ${\displaystyle st=a+b{\sqrt {D}}}$ and ${\displaystyle N(s)N(t)=p}$. But since in ${\displaystyle \mathbb {Z} }$ the only divisors of ${\displaystyle p}$ are ${\displaystyle -p}$, –1, 1 and ${\displaystyle p}$, this means that ${\displaystyle |N(s)|=1}$ and ${\displaystyle |N(t)|=|p|}$ or vice-versa. Therefore, ${\displaystyle a+b{\sqrt {D}}}$ is prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$. □

Of course ${\displaystyle N(p)=p^{2}}$, but we do have some other guidance to help us distinguish whether a prime from ${\displaystyle \mathbb {Z} }$ is also prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ or not. The next three theorems refer to fields that are UFDs.

Theorem P1. If ${\displaystyle p}$ is a prime in ${\displaystyle \mathbb {Z} }$, it is either also prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ or it is the product of exactly two primes in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ (though these are not necessarily distinct).[7]

Proof. PROOF GOES HERE. □[8]

So, if ${\displaystyle p}$ is composite in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$, we can search for ${\displaystyle a}$ and ${\displaystyle b}$ such that ${\displaystyle |N(a+b{\sqrt {D}})|=|p|}$. But that would be a futile search if ${\displaystyle p}$ is also prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$. Fortunately there is a way to tell whether such a search is worth undertaking in the first place. The number 2 is a special case, while the odd primes are all handled pretty much the same way.

Theorem P2. In order for 2 to be a prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$, the congruence ${\displaystyle D\equiv 5\mod 8}$ must hold. If instead ${\displaystyle D\equiv 3\mod 4}$, this means that 2 is the associate of the square of a prime, while ${\displaystyle D\equiv 1\mod 8}$ means that 2 is the product of two distinct primes.[9]

Proof. Since we stipulated that these theorems refer to UFDs, to prove the specified assertions for imaginary rings it is sufficient to prove it for the nine imaginary rings that actually have unique factorization. We see that ${\displaystyle 1+i}$, ${\displaystyle {\sqrt {-2}}}$ and ${\displaystyle {\frac {1}{2}}+{\frac {\sqrt {-7}}{2}}}$ are all divisors of 2 in ${\displaystyle \mathbb {Z} [i]}$, ${\displaystyle \mathbb {Z} [{\sqrt {-2}}]}$ and ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {7}})}}$, respectively. Then we verify that the equations ${\displaystyle x^{2}+3y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+3\left({\frac {y}{2}}\right)^{2}=2}$, ${\displaystyle x^{2}+11y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+11\left({\frac {y}{2}}\right)^{2}=2}$, ${\displaystyle x^{2}+19y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+19\left({\frac {y}{2}}\right)^{2}=2}$, ${\displaystyle x^{2}+43y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+43\left({\frac {y}{2}}\right)^{2}=2}$, ${\displaystyle x^{2}+67y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+67\left({\frac {y}{2}}\right)^{2}=2}$, ${\displaystyle x^{2}+163y^{2}=2}$ and ${\displaystyle \left({\frac {x}{2}}\right)^{2}+163\left({\frac {y}{2}}\right)^{2}=2}$ all lack integer solutions. Therefore, 2 is prime in ${\displaystyle \mathbb {Z} [\omega ]}$, ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-11}})}}$, ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-19}})}}$, ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-43}})}}$, ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-67}})}}$, ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-163}})}}$. Indeed ${\displaystyle -3\equiv 5\mod 8}$, as are –11, –19, –43, –67, –163, whereas –1, –2 and –7 are not.

As it is unknown whether there are infinitely many real quadratic rings that are UFDs, it would be impractical to examine real rings one by one as we did with the imaginary rings. So instead, we will construct the REST OF THE PROOF GOES HERE[10] □

Theorem P3. If ${\displaystyle p}$ is an odd prime in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$, coprime to ${\displaystyle D}$, then ${\displaystyle p}$ is composite if and only if the Legendre symbol ${\displaystyle \left({\frac {D}{p}}\right)=1}$.[11]

Proof. PROOF GOES HERE. □[12]

Remark. If ${\displaystyle \left({\frac {D}{p}}\right)=-1}$ there is no solution to ${\displaystyle a^{2}-Db^{2}=p}$ in integers, and that is true whether ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ is a UFD or not. However, if ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ is not a UFD, it can happen that ${\displaystyle \left({\frac {D}{p}}\right)=1}$ but ${\displaystyle p}$ is prime in that field anyway: it does sometimes happen that there is a solution in integers to ${\displaystyle a^{2}-Db=p}$ but not ${\displaystyle a^{2}-Db^{2}=p}$.

Armed with these facts, the identification of primes in ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}}$ (when that is a UFD) becomes very easy, and the factorization of composites becomes so easy that most textbooks say nothing about it. Here we will make a few remarks about it: if ${\displaystyle p=(-1)(a+b{\sqrt {D}})(a-b{\sqrt {D}})}$, then ${\displaystyle p^{2}=(a+b{\sqrt {D}})^{2}(a-b{\sqrt {D}})^{2}}$. In general, the inclusion of the unit –1 is required only when the exponent is odd, and we feel no need to include the unit 1 when the exponent is even.

Simple (i.e. UFD) quadratic integer rings.

A061574 Simple quadratic fields (i.e. with a unique prime factorization). (Note that the discriminant must be squarefree, i.e. from A005117(n).)

{–163, –67, –43, –19, –11, –7, –3, –2, –1, 1, 2, 3, 5, 6, 7, 11, 13, 14, 17, 19, 21, 22, 23, 29, 31, 33, 37, 38, 41, 43, 46, 47, 53, 57, 59, 61, 62, 67, 69, 71, 73, 77, 83, 86, 89, 93, 94, 97, 101, 103, 107, 109, 113, 118, 127, 129, 131, 133, 134, 137, 139, 141, 149, ...}

## Quadratic integer rings with negative discriminant

If ${\displaystyle \scriptstyle D\,<\,0\,}$ then ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ is called an imaginary quadratic integer ring, though it contains purely real and complex numbers as well as purely imaginary numbers.

### Simple quadratic integer rings with negative discriminant

Simple (i.e. UFD) quadratic integer rings with negative discriminant.

A?????? Simple (i.e. with a unique prime factorization) quadratic fields with negative discriminant. (Note that the discriminant must be squarefree, i.e. from A005117(n).)

{–163, –67, –43, –19, –11, –7, –3, –2, –1}

A003173 Heegner numbers: imaginary quadratic fields with unique factorization (or class number 1). (Note that the discriminant must be squarefree, i.e. from A005117(n).)

{1, 2, 3, 7, 11, 19, 43, 67, 163}

#### Quadratic integer ring with discriminant –1

Main article page: Gaussian integers

The [commutative] quadratic integer ring [with unity] ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {-1}}]\,}$ (or ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$), with units 1, ${\displaystyle \scriptstyle i\,}$, –1 and ${\displaystyle \scriptstyle -i\,}$, is a UFD. The primes in ${\displaystyle \scriptstyle \mathbb {Z} \,}$ which are congruent to 3 (mod 4) are also prime in ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$, while 2 and the primes in ${\displaystyle \scriptstyle \mathbb {Z} \,}$ which are congruent to 1 (mod 4) are the sum of two squares of positive integers, and thus are composite in ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$.

 1 Unit 2 ${\displaystyle \scriptstyle (-i)(1+i)^{2}\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. 3 Prime 4 ${\displaystyle \scriptstyle (-1)(1+i)^{4}\,}$ 5 ${\displaystyle \scriptstyle (-i)(2+i)(2i+1)\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. 6 ${\displaystyle \scriptstyle (-i)(1+i)^{2}3\,}$ 7 Prime 8 ${\displaystyle \scriptstyle i(i+1)^{6}\,}$ 9 32 10 ${\displaystyle \scriptstyle (-1)(i+1)^{2}(2i+1)(i+2)\,}$ This is the smallest composite, squarefree (in ${\displaystyle \scriptstyle \mathbb {Z} \,}$) positive integer for which both of its ${\displaystyle \scriptstyle \mathbb {Z} \,}$ prime factors are composite in ${\displaystyle \scriptstyle \mathbb {Z} [i]\,}$. 11 Prime 12 ${\displaystyle \scriptstyle (-1)(1+i)^{4}3\,}$ 13 ${\displaystyle \scriptstyle (3+2i)(3-2i)\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. 14 ${\displaystyle \scriptstyle (-i)(1+i)^{2}7\,}$ 15 ${\displaystyle \scriptstyle (-i)3(2+i)(2i+1)\,}$ 16 ${\displaystyle \scriptstyle (1+i)^{4}(1-i)^{4}\,}$ 17 ${\displaystyle \scriptstyle (4+i)(4-i)\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. 18 ${\displaystyle \scriptstyle (-i)(1+i)^{2}3^{2}\,}$ 19 Prime 20 ${\displaystyle \scriptstyle (1+i)^{2}(1-i)^{2}(2+i)(2-i)\,}$ 21 3 × 7

#### Quadratic integer ring with discriminant –3

Main article page: Eisenstein integers

Since ${\displaystyle -3\equiv 1\mod 4}$, the ring ${\displaystyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {-3}})}}$ includes algebraic integers like ${\displaystyle \omega ={\frac {1}{2}}+{\frac {\sqrt {-3}}{2}}}$, which is a complex cubic root of unity and has a norm of 1. ${\displaystyle \omega ^{2}}$ also has a norm of 1, as do ${\displaystyle -\omega }$ and ${\displaystyle (-\omega )^{2}}$. Hence ${\displaystyle \mathbb {Z} [\omega ]}$ has six units: 1, –1, ${\displaystyle \omega }$, ${\displaystyle \omega ^{2}}$, ${\displaystyle -\omega }$ and ${\displaystyle (-\omega )^{2}}$. ${\displaystyle \mathbb {Z} [\omega ]}$ is a unique factorization domain.

 1 Unit 2 Prime 3 ${\displaystyle (1+\omega )(1-\omega ^{2})}$ Prime in ${\displaystyle \mathbb {Z} }$ 4 22 5 Prime 6 ${\displaystyle 2(1+\omega )(1-\omega ^{2})}$ 7 ${\displaystyle (2+\omega )(2-\omega ^{2})}$ Prime in ${\displaystyle \mathbb {Z} }$ 8 23 9 ${\displaystyle (1+\omega )^{2}(1-\omega ^{2})^{2}}$ 10 2 × 5 11 Prime 12 ${\displaystyle 2^{2}(1+\omega )(1-\omega ^{2})}$ 13 ${\displaystyle (3+\omega )(3-\omega ^{2})}$ Prime in ${\displaystyle \mathbb {Z} }$ 14 ${\displaystyle 2(2+\omega )(2-\omega ^{2})}$ 15 ${\displaystyle (1+\omega )(1-\omega ^{2})5}$ 16 24 17 Prime 18 ${\displaystyle 2(1+\omega )^{2}(1-\omega ^{2})^{2}}$ 19 ${\displaystyle (3+2\omega )(3-2\omega ^{2})}$ 20 22 × 5

### Nonsimple quadratic integer rings with negative discriminant

Nonsimple (i.e. not UFD) quadratic integer rings with negative discriminant.

#### Quadratic integer ring with discriminant –5

The commutative quadratic integer ring with unity ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {-5}}],\,}$ with units being only 1 and –1, is not a UFD.

 1 Unit 2 Prime 3 Prime 4 22 5 ${\displaystyle \scriptstyle (-1)({\sqrt {-5}})^{2}\,}$ 6 ${\displaystyle \scriptstyle 2\,\cdot \,3\,=\,(1+{\sqrt {-5}})\,(1-{\sqrt {-5}})\,}$ The classic example that this field is not a UFD. 7 8 23 9 ${\displaystyle \scriptstyle 3^{2}\,=\,(2+{\sqrt {-5}})(2-{\sqrt {-5}})\,}$ 10 11 12 13 14 ${\displaystyle 2\times 7=(3-{\sqrt {-5}})(3+{\sqrt {-5}})}$ 15 16 24 17 18 19 20 21 ${\displaystyle 3\times 7=(1-2{\sqrt {-5}})(1+2{\sqrt {-5}})=(4-{\sqrt {-5}})(4+{\sqrt {-5}})}$ Unless we have overlooked a divisor somewhere, this constitutes an example of multiple factorization more elegant than 6.

Some authors prefer to write numbers in this field in the form ${\displaystyle \scriptstyle a+ib{\sqrt {5}}\,}$, which is perfectly valid since ${\displaystyle \scriptstyle {\sqrt {-5}}\,=\,i{\sqrt {5}}\,}$.

## Quadratic integer rings with positive discriminant

Main article page: Real quadratic integer rings

If ${\displaystyle \scriptstyle D\,>\,0\,}$ then ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ is called a real quadratic integer ring and contains only real numbers.

Note that ${\displaystyle \scriptstyle {\sqrt {D}}\,}$ is never a unit in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$ if that is a real field, as its norm works out to ${\displaystyle \scriptstyle -D\,}$. One consequence of this is that even if the discriminant is prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$, it is composite in ${\displaystyle \scriptstyle {\mathcal {O}}_{\mathbb {Q} ({\sqrt {D}})}\,}$.

A003649 Class number of real quadratic field Q(sqrt f), where f is the n-th squarefree number A005117(n).

{1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 1, 1, 2, 1, 2, 1, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 3, 4, 1, 2, 1, 2, 1, 2, 1, 1, 2, 1, 1, 2, 1, 2, 2, 1, 1, 2, 2, 1, 2, 2, 1, 2, 2, 2, 1, 1, 4, 1, 1, 1, 1, 2, 1, 1, 3, 2, 4, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 4, 1, 2, ...}

### Simple quadratic integer rings with positive discriminant

Simple (i.e. UFD) quadratic integer rings with positive discriminant.

A003172 ${\displaystyle Q({\sqrt {n}})}$ is a unique factorization domain (or simple quadratic field). (Note that the discriminant must be squarefree, i.e. from A005117(n).)

{2, 3, 5, 6, 7, 11, 13, 14, 17, 19, 21, 22, 23, 29, 31, 33, 37, 38, 41, 43, 46, 47, 53, 57, 59, 61, 62, 67, 69, 71, 73, 77, 83, 86, 89, 93, 94, 97, 101, 103, 107, 109, 113, 118, 127, 129, 131, 133, 134, 137, 139, 141, 149, 151, 157, 158, 161, 163, 166, 167, 173, 177, 179, 181, 191, 193, 197, 199, 201, ...}

#### Quadratic integer ring with discriminant 2

The [commutative] quadratic integer ring [with unity] ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {2}}]\,}$, with units of the form ${\displaystyle \scriptstyle \pm (1+{\sqrt {2}})^{n}\,}$ (${\displaystyle \scriptstyle n\,\in \,\mathbb {Z} \,}$), is a UFD. If an odd prime ${\displaystyle p\in \mathbb {Z} }$ is congruent of 1 or –1 modulo 8, it is composite in ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {2}}]\,}$, and obviously so is 2 (see A038873).

 1 Unit 2 ${\displaystyle \scriptstyle ({\sqrt {2}})^{2}\,}$ This seemingly roundabout expression is necessary in this field because this number is the discriminant. Somewhat counter-intuitively, ${\displaystyle \scriptstyle (2+{\sqrt {2}})(2-{\sqrt {2}})\,}$ does not count as a separate factorization because both multiplicands are associates of ${\displaystyle \scriptstyle {\sqrt {2}}\,}$ (e.g., ${\displaystyle \scriptstyle (2+{\sqrt {2}})\,=\,(1+{\sqrt {2}}){\sqrt {2}}\,}$). 3 Prime 4 ${\displaystyle \scriptstyle ({\sqrt {2}})^{4}\,}$ The factorization of ${\displaystyle \scriptstyle 2^{n}\,}$ in this field is ${\displaystyle \scriptstyle ({\sqrt {2}})^{2n}\,}$. 5 Prime 6 ${\displaystyle \scriptstyle ({\sqrt {2}})^{2}3\,}$ This is the smallest squarefree composite in ${\displaystyle \mathbb {Z} ^{+}}$ that is not squarefree in ${\displaystyle \mathbb {Z} [{\sqrt {2}}]}$. 7 ${\displaystyle \scriptstyle (3+{\sqrt {2}})(3-{\sqrt {2}})\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$. Some students are confused when they discover ${\displaystyle \scriptstyle (-1)(1+2{\sqrt {2}})(1-2{\sqrt {2}})\,=\,7\,}$ also, thinking they have found a distinct factorization, but again, other than –1, we're dealing with associates of the factors given in the middle column. 8 ${\displaystyle \scriptstyle ({\sqrt {2}})^{6}\,}$ 9 32 10 ${\displaystyle \scriptstyle ({\sqrt {2}})^{2}5\,}$ 11 Prime 12 ${\displaystyle \scriptstyle ({\sqrt {2}})^{4}3\,}$ 13 Prime 14 ${\displaystyle \scriptstyle ({\sqrt {2}})^{2}(3+{\sqrt {2}})(3-{\sqrt {2}})\,}$ 15 3 × 5 16 ${\displaystyle \scriptstyle ({\sqrt {2}})^{8}\,}$ 17 ${\displaystyle \scriptstyle (-1)(1+3{\sqrt {2}})(1-3{\sqrt {2}})\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$ 18 ${\displaystyle \scriptstyle ({\sqrt {2}})^{2}3^{2}\,}$ 19 Prime 20 ${\displaystyle \scriptstyle ({\sqrt {2}})^{4}5\,}$

#### Quadratic integer ring with discriminant 3

The commutative quadratic integer ring with unity ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {3}}],\,}$ with units being –1 and ${\displaystyle (2+{\sqrt {3}})^{n}}$, is a UFD.

 1 Unit 2 ${\displaystyle (-1)(1-{\sqrt {3}})(1+{\sqrt {3}})}$ Prime in ${\displaystyle \mathbb {Z} }$. 3 ${\displaystyle ({\sqrt {3}})^{2}}$ This roundabout expression is necessary because 3 is the discriminant of this field and therefore is not prime in it. 4 ${\displaystyle (1-{\sqrt {3}})^{2}(1+{\sqrt {3}})^{2}}$ 5 Prime 6 ${\displaystyle (-1)(1-{\sqrt {3}})(1+{\sqrt {3}})({\sqrt {3}})^{2}}$ 7 Prime 8 ${\displaystyle (-1)(1-{\sqrt {3}})^{3}(1+{\sqrt {3}})^{3}}$ 9 ${\displaystyle ({\sqrt {3}})^{4}}$ 10 ${\displaystyle (-1)(1-{\sqrt {3}})(1+{\sqrt {3}})5}$ 11 ${\displaystyle (-1)(1-2{\sqrt {3}})(1+2{\sqrt {3}})}$ Prime in ${\displaystyle \mathbb {Z} }$. 12 ${\displaystyle (1-{\sqrt {3}})^{2}(1+{\sqrt {3}})^{2}({\sqrt {3}})^{2}}$ 13 ${\displaystyle (-1)(4-{\sqrt {3}})(4+{\sqrt {3}})}$ Prime in ${\displaystyle \mathbb {Z} }$. 14 ${\displaystyle (-1)(1-{\sqrt {3}})(1+{\sqrt {3}})7}$ 15 ${\displaystyle ({\sqrt {3}})^{2}5}$ 16 ${\displaystyle (1-{\sqrt {3}})^{4}(1+{\sqrt {3}})^{4}}$ 17 Prime 18 ${\displaystyle (-1)(1-{\sqrt {3}})(1+{\sqrt {3}})({\sqrt {3}})^{4}}$ 19 Prime 20 ${\displaystyle (1-{\sqrt {3}})^{2}(1+{\sqrt {3}})^{2}5}$

#### Quadratic integer ring with discriminant 13

The commutative quadratic integer ring with unity ${\displaystyle \scriptstyle \mathbb {Z} [(1+{\sqrt {13}})/2]\,}$, with units of the form ${\displaystyle \scriptstyle \pm {\frac {1}{2}}(3+{\sqrt {13}})^{n}\,}$, is a unique factorization domain. Given a prime ${\displaystyle \scriptstyle p\,\in \,\mathbb {Z} \,}$, if ${\displaystyle \scriptstyle p\,}$ is a square modulo 13 (see A038883), then ${\displaystyle \scriptstyle p\,}$ is composite in ${\displaystyle \scriptstyle \mathbb {Z} [(1+{\sqrt {13}})/2]\,}$.

 1 Unit 2 Prime 3 ${\displaystyle \scriptstyle (-1)(7-2{\sqrt {13}})(7+2{\sqrt {13}})\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$ 4 22 5 Prime 6 ${\displaystyle \scriptstyle (-1)2(7-2{\sqrt {13}})(7+2{\sqrt {13}})\,}$ 7 Prime 8 23 9 ${\displaystyle \scriptstyle (7-2{\sqrt {13}})^{2}(7+2{\sqrt {13}})^{2}\,}$ 10 2 × 5 11 Prime 12 ${\displaystyle \scriptstyle (-1)(2^{2})(7-2{\sqrt {13}})(7+2{\sqrt {13}})\,}$ 13 ${\displaystyle \scriptstyle ({\sqrt {13}})^{2}\,}$ This seemingly roundabout expression is necessary in this field because this number is the discriminant. 14 2 × 7 15 ${\displaystyle \scriptstyle (-1)5(7-2{\sqrt {13}})(7+2{\sqrt {13}})\,}$ 16 24 17 ${\displaystyle \scriptstyle (15-4{\sqrt {13}})(15+4{\sqrt {13}})\,}$ Prime in ${\displaystyle \scriptstyle \mathbb {Z} \,}$ 18 ${\displaystyle \scriptstyle 2(7-2{\sqrt {13}})^{2}(7+2{\sqrt {13}})^{2}\,}$ 19 Prime 20 22 × 5

### Nonsimple quadratic integer rings with positive discriminant

Nonsimple (i.e. not UFD) quadratic integer rings with positive discriminant.

A146209 Integers a(n) for which the factorisation in the real quadratic field Q(sqrt(a(n)) is not unique. (Note that the discriminant must be squarefree, i.e. from A005117(n).)

{10, 15, 26, 30, 34, 35, 39, 42, 51, 55, 58, 65, 66, 70, 74, 78, 79, 82, 85, 87, 91, 95, 102, 105, 106, 110, 111, 114, 115, 119, 122, 123, 130, 138, 142, 143, 145, 146, 154, 155, 159, 165, 170, 174, 178, 182, 183, 185, 186, 187, 190, 194, 195, ...}

#### Quadratic integer ring with discriminant 10

The [commutative] quadratic integer ring [with unity] ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {10}}]\,}$, with units of the form ${\displaystyle \scriptstyle \pm (3+{\sqrt {10}})^{n}\,}$, is not a UFD.

 1 Unit 2 Prime[13] 3 Prime[13] 4 22 5 Prime 6 ${\displaystyle \scriptstyle 2\times 3\,=\,(4+{\sqrt {10}})(4-{\sqrt {10}})\,}$[13] Once again, 6 is the classic example that this field is not a UFD. 7 Prime 8 23 9 32 10 ${\displaystyle \scriptstyle 2\times 5\,=\,({\sqrt {10}})^{2}\,=\,(10+3{\sqrt {10}})(10-3{\sqrt {10}})\,}$ I'm not sure about that last one, but pretty sure it has at least two factorizations 11 12 13 14 15 16 24 17 18 19 20

#### Quadratic integer ring with discriminant 79

The real fields we have considered so far have class number either 1 or 2. ${\displaystyle \scriptstyle \mathbb {Z} [{\sqrt {79}}],\,}$ has class number 3. Its units are ${\displaystyle \pm (80+9{\sqrt {79}})^{n}}$.

 1 Unit 2 ${\displaystyle (9-{\sqrt {79}})(9+{\sqrt {79}})}$ 3 Prime The number 3 is not a quadratic residue of 79, and thus prime per the Remark for Theorem P3 above. 4 ${\displaystyle (9-{\sqrt {79}})^{2}(9+{\sqrt {79}})^{2}}$ 5 Prime Although 5 is a quadratic residue of 79, there is no solution to ${\displaystyle a^{2}-79b^{2}=5}$. If this was a UFD, then Theorem P3 above would mean that 5 is composite in this field. 6 ${\displaystyle (9-{\sqrt {79}})(9+{\sqrt {79}})3}$ 7 Prime 8 ${\displaystyle (9-{\sqrt {79}})^{3}(9+{\sqrt {79}})^{3}}$ 9 10 11 12 13 14 15 $\displaystyle 3 \times 5 = (–1)(8 + \sqrt{79})(8 – \sqrt{79})$ Here we get to use a semiprime other than 6 to show that the field in question is not a UFD. 16 ${\displaystyle (9-{\sqrt {79}})^{4}(9+{\sqrt {79}})^{4}}$ 17 Prime 18 19 20

## References

(Needs paper/book title, editor, year, ...)[14]

• Bolker
• William J. LeVeque, Elementary Theory of Numbers. Reading, Massachusetts: Addison-Wesley Publishing (1962)
• Niven-Borowski
• Ivan Niven & Herbert S. Zuckerman, An Introduction to the Theory of Numbers 4th Ed. New York, Chichester, Brisbane, Toronto: John Wiley & Sons (1980)
• Weintraub, Steven H. (2008). A K Peters Series. ed. Factorization: Unique and Otherwise (CMS Treatises in Mathematics). Canadian Mathematical Society/Société mathématique du Canada. ISBN 978-1-56881-241-0.

## Notes

1. Other notations such as ${\displaystyle \scriptstyle {\mathcal {O}}({\sqrt {D}})\,}$, ${\displaystyle \scriptstyle \mathbb {Q} [{\sqrt {D}}]\,}$ and ${\displaystyle \scriptstyle \mathbb {A} [D]\,}$ are also used, although the latter notation doesn't make it clear that the number ring is quadratic.
2. Needs proof.
3. To do.
4. To do.
5. To do.
6. This is Theorem 9.24 in Niven-Zuckerman, page 250.
7. This is Theorem 9.29 (1) in Niven-Zuckerman, page 254.
8. Needs proof.
9. This is Theorem 9.29 (4) in N-Z.
10. To do.
11. This is Theorem 9.29 (3) in N-Z.
12. Needs proof.
13. LeVeque, p. 107.
14. To do: Add paper/book title, editor, year, ....