Let $\Delta$ be a fundamental quadratic discriminant, set $N = |\Delta|$, and define the Fekete polynomials $$ F_N(X) = \sum_{a=1}^N \Big(\frac{\Delta}a\Big) X^a. $$ Define $$ f_N(X) = \frac{F_N(X)}{X^N-1}. $$ Canceling common factors it can be shown that $$ f_N(X) = \frac{H_N(X)}{\Phi_N(X)}, $$ where $\Phi_N$ is the $N$-th cyclotomic polynomial and $H$ has integral coefficients. (These definitions seem rather ad hoc, but in fact the objects above are all quite "natural".)

If $\Delta < 0$, then $f_N(1) = \frac{2h}w$, where $h$ is the class number of $\Delta$ and $w$ the number of roots of unity in the corresponding quadratic number fields. In fact we get $$ f_N(1) = - \frac{\sum_{a=1}^{N-1} a \Big( \frac{\Delta}a\Big)}N . $$

If $\Delta > 0$, then $f_N(1) = 0$, which suggests looking at the first derivative. Here we find that $f_N'(1)$ is always even, so we set $f_N'(1) = - 2 h$ and get $$ h = \frac{\sum_{a=1}^{N-1} \frac{a(a-1)}2 \Big( \frac{\Delta}a\Big)}N . $$ Here is a small table: $$ \begin{array}{c|ccccccccccc} N & 12 & 13 & 17 & 21 & 24 & 28 & 29 & 33 & 37 & 41 & 44 \\\ \hline h & 1 & 1 & 2 & 2 & 3 & 4 & 3 & 6 & 5 & 8 & 7 \end{array} $$

It is quite remarkable that $h$ seems to possess, for positive discriminants, properties analogous to class numbers. In particular, $h$ is odd if and only if $\Delta = p > 5$ is a prime $\equiv 5 \bmod 8$, and if $\Delta$ is divisible by $n$ distinct primes, then $h$ is divisible by $2^{n-2}$ etc.

In the case $\Delta < 0$, Hasse and Bergström have shown how to extract the "genus factor" from the analytic class number formula, but the necessary calculations were horrible. Thus if we want to avoid going through similar technicalities in the case $\Delta > 0$ then we would need a natural interpretation of $h$ as the order of an analogue of a "class group".

So I guess my question is whether there is such a mysterious group (connected to real quadratic number fields) with order $h$. Even a proof that $h \ne 0$ would be welcome, since in the case of negative discriminants this is equivalent to the nonvanishing of Dirichlet's L-function at $s = 1$.

**Edit.** As Rene Schoof has pointed out, the numbers in question
are essentially generalized Bernoulli numbers $B_{2,\chi}$ for
(quadratic) Dirichlet characters with conductor $N$. These numbers
are defined by
$$ B_{2,\chi} = \sum_{a=1}^N \chi(a) B_2(a/N), $$
where $B_2(X) = X^2 - X + \frac16$ is the second Bernoulli polynomial.
The constant term $\frac 16$, in which this expression differs from the
one I have used above, is irrelevant since $\sum \chi(a) = 0$.

These numbers $B_{2,\chi}$ show up as factors of eigenspaces of cuspidal divisor class groups as studied in the book by Kubert-Lang (more exactly, the $p$-part of the group is reflected in the divisibility by $p$ of the Bernoulli numbers). The Birch-Tate-Lichtenbaum conjecture also predicts that the $B_{2,\chi}$ are factors of $K_2({\mathcal O})$, where ${\mathcal O}$ is the ring of integers of the maximal real subfield of the $N$-th roots of unity (Kubert-Lang, p. 151).

Although these numbers have such a prominent place in number theory, their elementary properties apparently have not been investigated (I've looked into Washington's and Lang's books on cyclotomic number fields). Numerical experiments suggest e.g. the following:

Let $\chi$ be an even Dirichlet character with conductor $N$.
Then $h_2(N) = \frac{N}4 B_{2,\chi}$ is an integer for all $N > 8$.

Moreover, $h_2(N)$ is odd if and only if

- $N = p$ for primes $p \not \equiv 1 \bmod 8$;
- $N = 4p$ for primes $p \equiv 3 \bmod 8$;
- $N = 8p$ for odd primes $p \not \equiv \pm 1 \bmod 8$.

In absence of any kind of genus theory for cuspidal divisor class groups it seems that the only option for proving such results is working directly with the definition of these numbers. As mentioned above, this becomes technical for integers with many prime factors.

There are similar results for $h_3(N) = \frac{N^2}6 B_{3,\chi}$, and there can be no doubt that most of this generalizes in some form to all generalized Bernoulli numbers $B_{n,\chi}$.

This whole set of question came out of my approach to quadratic reciprocity in Chapter 7 of my notes on Pell conics.