= Enumeration of reduced binary quadratic forms
Let $D<0$ with $D\equiv0$ or $1\pmod4$. A <reduced positive definite binary quadratic form> $[a,b,c]$ of <discriminant of a binary quadratic form> $D$ satisfies
$$
|D|=4ac-b^2\geq4a^2-a^2=3a^2.
$$
Consequently every reduced form can be found by a finite search:
* choose $1\leq a\leq\lfloor\sqrt{|D|/3}\rfloor$;
* choose $-a\leq b\leq a$ with $b^2\equiv D\pmod{4a}$;
* put $c=(b^2-D)/(4a)$ and retain $c\geq a$;
* on $|b|=a$ or $a=c$, retain only $b\geq0$.
To count the <class number of a negative discriminant>, additionally retain only <primitive binary quadratic forms>, those with $\gcd(a,b,c)=1$. Otherwise the search also lists imprimitive forms. For example, $D=-12$ gives $[1,0,3]$ and $[2,2,2]$, but only the first is primitive, so $h(-12)=1$. This distinction is essential when turning an enumeration into a class-number claim.
Back to article page