I wish to find a closed form expression for the integral:
$$\int_0^\pi (z+\sqrt{z^2-1} \cos x)^q \cos(nx)\ dx$$
where $z > 1$ and $q,n \in \mathbb{R}$. Thankfully, there is a closed form result if $n$ is an integer, given in Gradshteyn and Ryzhik (2014 edition, page 406, section 3.664):
where $P_q^n$ are the legendre functions of the first kind.
In order to find a solution for $n\in\mathbb{R}$, I thought to express the above product in terms of gamma functions, so that:
$$\int_0^\pi (z+\sqrt{z^2-1})^q \cos(nx) dx = \frac{\Gamma(1+q)\pi}{\Gamma(1+q+n)} P_q^n(z),$$
but a quick numerical check shows that this equality is not true for non-integer $n$.

Where is the mistake? Is this a question of choosing a different branch-cut for the legendre functions?