Solution (source code)

= Solution

For a current element $I\,d\boldsymbol\ell$, the <Biot-Savart law> is
$$
d\mathbf B=\frac{\mu_0I}{4\pi}\frac{d\boldsymbol\ell\times\mathbf R}{R^3}.
$$
Take a straight wire along $z$, extending from $-a$ to $a$, and observe its <magnetic field> at $(s,0,0)$. All contributions point in $+\hat{\boldsymbol\phi}$ for positive $I$ along $+z$, by the <right-hand rule>. Their magnitude integrates to
$$
B_\phi=\frac{\mu_0I}{4\pi}\int_{-a}^{a}\frac{s\,dz}{(s^2+z^2)^{3/2}}
=\frac{\mu_0I}{4\pi}\left[\frac{z}{s\sqrt{s^2+z^2}}\right]_{-a}^{a}
=\boxed{\frac{\mu_0Ia}{2\pi s\sqrt{s^2+a^2}}}.
$$
For $a/s\to\infty$ this becomes $\mu_0I/(2\pi s)$, so $\oint\mathbf B\cdot d\boldsymbol\ell=2\pi sB_\phi=\mu_0I$, exactly as <Ampère's law> requires for an infinite straight wire.