Do real quadratic number fields with prime discriminants have odd class numbers? Using the software SageMath I confirmed that there is no real quadratic number field of prime discriminant $D<10^6$ with an even class number. Is this only true for small discriminants or a general truth?
Edit: Why was this question closed?
 A: Genus theory deals with the easy piece of class groups in (mainly cyclic) Galois extensions. For quadratic extensions $K$, it goes back to Gauss, who proved, in the language of binary quadratic forms, that the ideal class of a prime ideal $P$ above an unramified prime $p$ is a square if and only if $(d_1/p) = \ldots = (d_t/p)$, where $(\cdot/\cdot)$ is the Kronecker symbol and where $d = d_1 \cdots d_t$ is the factorization of the discriminant $d$ of $K$ into prime discriminants $d_i$. This implies that for $C = Cl^+(K)$ we have $C/C^2 \simeq (\mathbb Z/2\mathbb Z)^{t-1}$. The class group Cl$^+(K)$ in the strict sense is the same as the usual class group if $d < 0$, or if $d > 0$ and the fundamental unit has norm $-1$; otherwise it is twice as big.
If the discriminant $d$ is prime, then $t = 1$, hence $C/C^2 = 1$ and therefore $C = C^2$. If squaring is an automorphism of a finite group, the group must have odd order. The same conclusion holds if $t = 2$ and the norm of the fundamental unit is positive, i.e., if $d = 2q$ for primes $q \equiv 3 \bmod 4$.
See Flath, Introduction to Number Theory, or Harvey Cohn's Advanced number theory for proofs.
A: Yes, they do. To see why, consider the class number formula. It says:
$\prod_{n=1}^{p-1}(1-\zeta_{p}^{n})^{\chi(n)} =\epsilon^{2h}$
Where $\epsilon$ is the positive fundamental unit and $h$ is the class number. Rationalize the denominator. Then Take the square root to isolate $\epsilon^{h}$.
This can be rewritten as:
$\frac{1}{\sqrt{p}}\prod_{n \equiv \square}(1-\zeta_{p}^{n}) = \epsilon^{h}$
Where the product is taken over all square residues $n$ between 0 and $p$. Take the field norm of the entire expression. The field norm of the product is $p$, and the field norm of $\sqrt{p}$ is $-p$. The field norm of $\epsilon$ is $\pm 1$, but this won’t matter which one it is. This normed quantity looks like:
$\frac{p}{-p} = (\pm 1)^{h} = -1$
In this case, $h$ must be odd. This also tells you that $N(\epsilon)$ must also be $-1$.
