The discriminnant discriminant $D$ of a quadratic number field can be written uniquely as a product of prime discriminants, namely $-4$, $\pm 8$, and $p^* = (-1)^{(p-1)/2}p$ for odd primes $p$. The Dirichlet series for odd discriminants therefore simply is $$\sum_{D \text{ odd}} |D|^{-s} = \prod_{p \text{ odd}} (1 + p^{-s}),$$ and the contribution of the even prime discriminants is taken care of by the factor $$1 + 4^{-s} + 2 \cdot 8^{-s}.$$ Both the beautiful as well as the much nicer formula now follow immediately.
Factorization of quadratic discriminants into prime discriminants holds over totally real algebraic number fields with class number $1$ in the strict sense (see e.g. L. Goldstein, On prime discriminants, Nagoya Math. J. 45, 119-127 (1972); J. Sunley, Remarks concerning generalized prime discriminants, Boulder 1972; J. Sunley, Prime discriminants in real quadratic fields of narrow class number one, Carbondale 1979); a weaker version good enough for the purpose of counting discriminants works if the class number in the strict sense is odd.
The discriminnant $D$ of a quadratic number field can be written uniquely as a product of prime discriminants, namely $-4$, $\pm 8$, and $p^* = (-1)^{(p-1)/2}p$ for odd primes $p$. The Dirichlet series for odd discriminants therefore simply is $$\sum_{D \text{ odd}} |D|^{-s} = \prod_{p \text{ odd}} (1 + p^{-s}),$$ and the contribution of the even prime discriminants is taken care of by the factor $$1 + 4^{-s} + 2 \cdot 8^{-s}.$$ Both the beautiful as well as the much nicer formula now follow immediately.
Factorization of quadratic discriminants into prime discriminants holds over algebraic number fields with class number $1$ in the strict sense; a weaker version good enough for the purpose of counting discriminants works if the class number in the strict sense is odd.