Solution (source code)

= Solution

A <reduced positive definite binary quadratic form> $[a,b,c]$ satisfies
$$
|b|\leq a\leq c,
$$
with $b\geq0$ when either $|b|=a$ or $a=c$. For $d\equiv0$ or $3\pmod4$, the <class number of a negative discriminant> $h(-d)$ is the number of proper equivalence classes of primitive positive definite <integral> forms of discriminant $-d$, equivalently the number of their reduced representatives.

Write
$$
d=\prod_{j=1}^k p_j^{e_j}.
$$
Partitioning the $k$ complete prime-power factors between $r$ and $s$ gives $2^k$ ordered factorizations $d=rs$ with $\gcd(r,s)=1$. After identifying $(r,s)$ with $(s,r)$, there are $2^{k-1}$ choices with $r\leq s$. Each gives the primitive reduced form
$$
[r,0,s],
$$
whose discriminant is $-4rs=-4d$. The uniqueness of reduced representatives makes these classes distinct, proving the <coprime-factorization lower bound for a quadratic-form class number>
$$
h(-4d)\geq2^{k-1}.
$$

The inequality can be strict. For $d=5$, there is one distinct prime factor, while the reduced primitive forms of discriminant $-20$ are
$$
[1,0,5]\quad\hbox{and}\quad[2,2,3].
$$
\b[Thus $h(-20)=2>1=2^{1-1}$.]