Solution (source code)

= Solution

Use $X_i=n_i/n_B$, so $X_D$ counts <deuterium> nuclei per baryon, not baryons bound into <deuterium>. For the radiative capture reaction, <chemical equilibrium> and the zero <photon chemical potential> give $\mu_D=\mu_n+\mu_p$. Dividing the three <nonrelativistic Maxwell--Boltzmann number densities> removes all <chemical potentials>:
$$
\frac{n_D}{n_nn_p}
=\frac{g_D}{g_ng_p}
\left(\frac{m_D}{m_nm_p}\right)^{3/2}
\left(\frac{2\pi}{T}\right)^{3/2}
\exp\!\left[-\frac{m_D-m_n-m_p}{T}\right].
$$
Here $g_D=3$ and $g_n=g_p=2$. The binding convention in this PDF is a negative mass defect, $B_D=m_D-m_n-m_p<0$. The positive <nuclear binding energy> is $\varepsilon_D=-B_D$, so the abundance is enhanced by $e^{-B_D/T}$, not by $e^{B_D/T}$.

Since $X_D/(X_nX_p)=n_Bn_D/(n_nn_p)$, insert the <baryon-to-photon ratio> $n_B=\eta n_\gamma$ and the <photon number density> $n_\gamma=2\zeta(3)T^3/\pi^2$. This gives
$$
\boxed{\frac{X_D}{X_nX_p}
=\eta\frac{2\zeta(3)}{\pi^2}T^3
\frac34\left(\frac{m_D}{m_nm_p}\right)^{3/2}
\left(\frac{2\pi}{T}\right)^{3/2}e^{-B_D/T}.}
$$
At equal nucleon mass $m_N$ in the prefactors, $m_D\simeq2m_N$, the <deuterium equilibrium abundance> simplifies to
$$
\boxed{\frac{X_D}{X_nX_p}
\simeq\frac{12\zeta(3)}{\sqrt\pi}\,
\eta\left(\frac{T}{m_N}\right)^{3/2}e^{-B_D/T}.}
$$
The dimensionless prefactor is about $8.14$. These expressions describe <thermal equilibrium>; residual primordial <deuterium> after nuclear reactions cease must instead be obtained from the reaction kinetics.