I noticed a relationship between the size of class group of binary quadratic forms with discriminant $D=-p$ and $D=-4p$ with prime $p$: $$ \begin{aligned} p\equiv3\ (\text{mod }8) &\quad\Longrightarrow\quad h(-4p)=3h(-p) \\ p\equiv7\ (\text{mod }8) &\quad\Longrightarrow\quad h(-4p)=h(-p) \end{aligned} $$
I used Sage to check the first 1 million primes of either case, and it holds for all except $p=3$.
If this is true, is there a simple relationship between the forms?
(and is the group structure compatible with this relationship?)
And what is special about 3 here?
With $n>3$ square free $\equiv 3\bmod 4$ and $O_K=\Bbb{Z}[\frac{1+\sqrt{-n}}{2}],O=\Bbb{Z}[\sqrt{-n}]$ (the quadratic rings with discriminant $-n$ and $-4n$) then $$\frac{h(-4n)}{h(-n)}=\frac{|Cl(O)|}{|Cl(O_K)|}$$
Is the size of the kernel of the surjective homomorphism of the ideal class groups $$Cl(O)\to Cl(O_K),\qquad I\to I O_K$$ The kernel is $$ \{ a O_K\cap O,a\in (O_K/J)^\times\}\cong (O_K/J)^\times / O_K^\times \cong (O_K/J)^\times$$ where $J=\{b\in O_K,bO_K\subset O\}=2O_K$.
If $n\equiv 3\bmod 8$ then $2O_K$ is a prime ideal and $(O_K/2O_K)^\times$ has $3$ elements
If $n\equiv 7\bmod 8$ then $2O_K=(2O_K+\frac{1+\sqrt{-n}}{2}O_K)(2O_K+\frac{1-\sqrt{-n}}{2}O_K)$ and $(O_K/2O_K)^\times$ has $1$ element
$n=3$ is special because $\frac{1+\sqrt{-3}}{2}$ is a root of unity so the image of $O_K^\times$ in $O_K/J^\times$ isn't trivial.