Solution (source code)

= Solution
{c}

Write the observation point as $(0,0,h)$ with $h>0$, reserving source coordinates for the <integral>. For the straight segment, $ds'=dx'$ and the separation is $\sqrt{x'^2+h^2}$. Therefore its <Newtonian gravitational potential> is
$$
\begin{aligned}
\phi(h)
&=-G\gamma\int_{-a}^a\frac{dx'}{\sqrt{x'^2+h^2}}\\
&=-2G\gamma\left[\log\bigl(x'+\sqrt{x'^2+h^2}\bigr)\right]_0^a\\
&=\boxed{-2G\gamma\log\left(\frac{a+\sqrt{a^2+h^2}}{h}\right)}.
\end{aligned}
$$
Equivalently $\phi(h)=-2G\gamma\operatorname{arsinh}(a/h)$. At large $h$ it approaches $-G(2a\gamma)/h$, the <Newtonian potential of a point mass> with the segment's total <mass>.