Solution (source code)

= Solution

Chemical equilibrium gives $\mu_D=\mu_p+\mu_n$. Substitution of the three Maxwell--Boltzmann densities therefore cancels the <chemical potentials> and leaves the rest-mass factor
$$
\exp\left(\frac{(m_p+m_n-m_D)c^2}{k_BT}\right)
=e^{B_D/(k_BT)}.
$$
Using $g_p=g_n=2$, $g_D=4$, $m_n\simeq m_p$, and $m_D\simeq2m_p$, the translational prefactor is
$$
\frac{4(2\pi m_Dk_BT/h^2)^{3/2}}
 {4(2\pi m_pk_BT/h^2)^{3/2}(2\pi m_nk_BT/h^2)^{3/2}}
\simeq\left(\frac{\pi m_pk_BT}{h^2}\right)^{-3/2}.
$$
Hence
$$
\boxed{\frac{n_D}{n_pn_n}\simeq
\left(\frac{\pi m_pk_BT}{h^2}\right)^{-3/2}
e^{B_D/(k_BT)}}.
$$