Solution (source code)

= Solution

Differentiate under the contour integral, with one consistent branch and convergent endpoint behavior. Then
$$
zw''+2kw'+zw=\int_\gamma\big[z(t^2+1)+2kt\big](t^2+1)^{k-1}e^{zt}dt
=\int_\gamma\frac{d}{dt}\big[(t^2+1)^ke^{zt}\big]dt.
$$
The stated zero boundary term therefore makes the integral a solution. On a closed contour this means returning to the same branch; on an open contour it requires the endpoint values to cancel or vanish.