# A class number estimate

Let $$\mathcal{D} = \{D \in \mathbb{Z} : D \equiv 0, 1 \pmod{4}\}$$ be the set of discriminants. It is well-known that each element in $$\mathcal{D}$$ is the discriminant of a primitive binary quadratic form, namely $$x^2 - (D/4)y^2$$ when $$D \equiv 0 \pmod{4}$$ and $$x^2 + xy - (D-1)y^2/4$$ when $$D \equiv 1 \pmod{4}$$.

For a primitive binary quadratic form $$f$$ the group $$\text{SL}_2(\mathbb{Z})$$ acts on it via substitution. Denote by $$[f]$$ the $$\text{SL}_2(\mathbb{Z})$$-equivalence class of $$f$$. Note that the discriminant is a $$\text{SL}_2(\mathbb{Z})$$-invariant, so that for each $$g, h \in [f]$$ we have $$\Delta(g) = \Delta(h)$$, so we may write $$\Delta([f])$$, the common value for $$\Delta(g), g \in [f]$$, to be the discriminant of the equivalence class. For each $$D \in \mathcal{D}$$, put

$$\displaystyle h(D) = \#\{[f] : f \text{ primitive}, \Delta([f]) = D\}$$

for the class number of primitive binary quadratic forms of discriminant $$D$$.

Observe that the set of squares is contained in $$\mathcal{D}$$, and it is well-known that $$h(n^2) = \phi(n)$$, and representatives of the distinct $$\text{SL}_2(\mathbb{Z})$$-classes of discriminant $$n^2$$ are given by

$$\displaystyle ax^2 + nxy : \gcd(a,n) = 1, 1 \leq a \leq n-1.$$

My question is, what about $$h(-4n^2)$$? Is there a nice characterization of them like the case of positive squares? Equivalently, can one find all reduced forms, i.e., a form $$f(x,y) = ax^2 + bxy + cy^2$$ with $$|b| \leq a \leq c, a,c > 0$$ of discriminant $$-4n^2$$?

Certainly, factoring $$n^2 = u^2 v^2$$ with $$\gcd(u,v) = 1$$ gives a primitive form $$(ux)^2 + (vy)^2$$ of discriminant $$-4n^2$$... but there are other forms such as $$4x^2 + 4xy + 5y^2$$ with discriminant $$-64$$ that do not arise this way.

This is from Buell, Binary Quadratic Forms, pages 109-119.

Note that $$h(-16) = h(-4) = 1.$$

When $$p$$ is an odd prime, we use the Legndre symbol in $$h(-4p^2) = \frac{p - (-1|p)}{2}$$

After that, if $$u > 1,$$ while $$u$$ is allowed odd or even as needed; if $$p$$ does not divide $$u,$$ then $$h(-4u^2p^2) = h(-4 u^2) \cdot \left(p - (-1|p) \right).$$ If $$p$$ divides $$u,$$ $$h(-4u^2p^2) = h(-4 u^2) \cdot p.$$ $$h(-16u^2) = 2 h(-4 u^2)$$

Let's see; note that $$p - (-1|p)$$ for an odd prime $$p$$ is always divisble by $$4,$$ so these class numbers are even, and the max power of $$2$$ grows. This is fair, the number of genera is growing with each new prime and is always a power of two, while each discriminant has a constant number of classes per genus.

For example, with odd $$n > 1,$$ if $$n = \prod_p p^{e_p}$$ we get $$h(-4n^2) = \frac{1}{2} \prod_p \left( p - (-1|p)\right) p^{e_p -1}$$

The conclusion is that $$h(-4n^2)$$ is mostly pretty similar in size to $$\frac{n}{2} .$$ In order to deviate much from that, it is most efficient to have $$n$$ squarefree odd, with either $$n = 5 \cdot 13 \cdot 17 ...$$ the product of the consecutive primes $$1 \pmod 4$$ up to some bound $$P,$$ or $$n = 3 \cdot 7 \cdot 11 \cdot 19 ...$$ the product of the consecutive primes $$3 \pmod 4$$ up to some bound. In these cases, the growth or shrinkage of $$h$$ is still bounded by Merten's Theorem, in one version (H+W_thm427) $$\sum_{p \leq x} \frac{1}{p} = \log \log x + B + o(1).$$ I guess if we are taking half the primes according to mod 4, we would expect the estimate to be halved.

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

  n      -4 n^2      h      n factored
1          -4      1      factor n  =  1
2         -16      1      factor n  = 2
3         -36      2      factor n  = 3
4         -64      2      factor n  = 2^2
5        -100      2      factor n  = 5
6        -144      4      factor n  = 2 * 3
7        -196      4      factor n  = 7
8        -256      4      factor n  = 2^3
9        -324      6      factor n  = 3^2
10        -400      4      factor n  = 2 * 5
11        -484      6      factor n  = 11
12        -576      8      factor n  = 2^2 * 3
13        -676      6      factor n  = 13
14        -784      8      factor n  = 2 * 7
15        -900      8      factor n  = 3 * 5
16       -1024      8      factor n  = 2^4
17       -1156      8      factor n  = 17
18       -1296     12      factor n  = 2 * 3^2
19       -1444     10      factor n  = 19
20       -1600      8      factor n  = 2^2 * 5
21       -1764     16      factor n  = 3 * 7
22       -1936     12      factor n  = 2 * 11
23       -2116     12      factor n  = 23
24       -2304     16      factor n  = 2^3 * 3
25       -2500     10      factor n  = 5^2
26       -2704     12      factor n  = 2 * 13
27       -2916     18      factor n  = 3^3
28       -3136     16      factor n  = 2^2 * 7
29       -3364     14      factor n  = 29
30       -3600     16      factor n  = 2 * 3 * 5
31       -3844     16      factor n  = 31
32       -4096     16      factor n  = 2^5
33       -4356     24      factor n  = 3 * 11
34       -4624     16      factor n  = 2 * 17
35       -4900     16      factor n  = 5 * 7
36       -5184     24      factor n  = 2^2 * 3^2
37       -5476     18      factor n  = 37
38       -5776     20      factor n  = 2 * 19
39       -6084     24      factor n  = 3 * 13
40       -6400     16      factor n  = 2^3 * 5
41       -6724     20      factor n  = 41
42       -7056     32      factor n  = 2 * 3 * 7
43       -7396     22      factor n  = 43
44       -7744     24      factor n  = 2^2 * 11
45       -8100     24      factor n  = 3^2 * 5
46       -8464     24      factor n  = 2 * 23
47       -8836     24      factor n  = 47
48       -9216     32      factor n  = 2^4 * 3
49       -9604     28      factor n  = 7^2
50      -10000     20      factor n  = 2 * 5^2
51      -10404     32      factor n  = 3 * 17
52      -10816     24      factor n  = 2^2 * 13
53      -11236     26      factor n  = 53
54      -11664     36      factor n  = 2 * 3^3
55      -12100     24      factor n  = 5 * 11
56      -12544     32      factor n  = 2^3 * 7
57      -12996     40      factor n  = 3 * 19
58      -13456     28      factor n  = 2 * 29
59      -13924     30      factor n  = 59
60      -14400     32      factor n  = 2^2 * 3 * 5
61      -14884     30      factor n  = 61
62      -15376     32      factor n  = 2 * 31
63      -15876     48      factor n  = 3^2 * 7
64      -16384     32      factor n  = 2^6
65      -16900     24      factor n  = 5 * 13
66      -17424     48      factor n  = 2 * 3 * 11
67      -17956     34      factor n  = 67
68      -18496     32      factor n  = 2^2 * 17
69      -19044     48      factor n  = 3 * 23
70      -19600     32      factor n  = 2 * 5 * 7
71      -20164     36      factor n  = 71
72      -20736     48      factor n  = 2^3 * 3^2
73      -21316     36      factor n  = 73
74      -21904     36      factor n  = 2 * 37
75      -22500     40      factor n  = 3 * 5^2
76      -23104     40      factor n  = 2^2 * 19
77      -23716     48      factor n  = 7 * 11
78      -24336     48      factor n  = 2 * 3 * 13
79      -24964     40      factor n  = 79
80      -25600     32      factor n  = 2^4 * 5
81      -26244     54      factor n  = 3^4
82      -26896     40      factor n  = 2 * 41
83      -27556     42      factor n  = 83
84      -28224     64      factor n  = 2^2 * 3 * 7
85      -28900     32      factor n  = 5 * 17
86      -29584     44      factor n  = 2 * 43
87      -30276     56      factor n  = 3 * 29
88      -30976     48      factor n  = 2^3 * 11
89      -31684     44      factor n  = 89
90      -32400     48      factor n  = 2 * 3^2 * 5
91      -33124     48      factor n  = 7 * 13
92      -33856     48      factor n  = 2^2 * 23
93      -34596     64      factor n  = 3 * 31
94      -35344     48      factor n  = 2 * 47
95      -36100     40      factor n  = 5 * 19
96      -36864     64      factor n  = 2^5 * 3
97      -37636     48      factor n  = 97
98      -38416     56      factor n  = 2 * 7^2
99      -39204     72      factor n  = 3^2 * 11
100      -40000     40      factor n  = 2^2 * 5^2
n      -4 n^2      h      n factored


=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=