Solution (source code)

= Solution

Choose the loop axis as $+x$, with positive <electric current> circulating by the right-hand rule. The <Biot-Savart law> is
$$
d\mathbf B=\frac{\mu_0I}{4\pi}\frac{d\boldsymbol\ell\times\mathbf r}{r^3}.
$$
For a loop element and an axial observation point, $r=\sqrt{a^2+x^2}$. The transverse components cancel between opposite elements. The axial component of $d\boldsymbol\ell\times\mathbf r$ is $a\,d\ell$, so
$$
B_x=\frac{\mu_0Ia}{4\pi(a^2+x^2)^{3/2}}\oint d\ell
=\frac{\mu_0Ia^2}{2(a^2+x^2)^{3/2}}.
$$
Thus
$$
\boxed{\mathbf B(x)=\frac{\mu_0Ia^2}{2(a^2+x^2)^{3/2}}\hat{\mathbf x}.}
$$
Reversing the <electric current> reverses the field. At the centre $B=\mu_0I/(2a)$, while the far field decreases as $|x|^{-3}$, as expected for a <magnetic dipole>.