Solution (source code)

= Solution

Let the wire lie along $z$, and observe at perpendicular distance $r$. In the <Biot-Savart law>, the azimuthal contributions from line elements add with magnitude
$$
B(r)=\frac{\mu_0I_0}{4\pi}\int_{-\infty}^{\infty}\frac{r\,dz}{(r^2+z^2)^{3/2}}=\frac{\mu_0I_0}{2\pi r}.
$$
Independently, cylindrical symmetry makes the field constant and azimuthal on a circular <Amperian loop>, so <Ampère's law> gives $2\pi rB=\mu_0I_0$. Both yield
$$
\boxed{\mathbf B=\frac{\mu_0I_0}{2\pi r}\hat{\boldsymbol\phi},}
$$
with direction fixed by the right-hand rule.