Solution (source code)

= Solution

The <specific angular momentum> is $h=\sqrt{GM_\star a(1-e^2)}$, so the <periapsis angular speed> is
$$
\dot\theta_{\rm peri}=\frac h{a^2(1-e)^2}
=n\frac{\sqrt{1+e}}{(1-e)^{3/2}}.
$$
At the <exterior mean-motion resonance>, neglecting <radiation pressure>, $n/n_p=p/(p+q)$. Thus at the limiting <orbital eccentricity> $e=\sqrt{2q/(5p-q)}$,
$$
\boxed{\frac{\dot\theta_{\rm peri}}{n_p}
=\frac p{p+q}\frac{\sqrt{1+\sqrt{2q/(5p-q)}}}{[1-\sqrt{2q/(5p-q)}]^{3/2}}.}
$$
The condition for overtaking the planet in angle is
$$
\boxed{\frac{p^2}{(p+q)^2}(1+e)>(1-e)^3,\qquad e=\sqrt{\frac{2q}{5p-q}}<1.}
$$
For the formal second-order equilibrium, it holds for every physical bound value $0<q<5p/3$. To see this, rewrite $q/p=5e^2/(2+e^2)$, so $p/(p+q)=(2+e^2)/(2+6e^2)$. For $0<e<1$, $\sqrt{1+e}/(1-e)^{3/2}>1+2e$, while
$$
(2+e^2)(1+2e)-(2+6e^2)=e(4-5e+2e^2)>0.
$$
The instantaneous angular motion is therefore prograde relative to the planet near <periapsis>, although its mean relative motion is retrograde. The range $q\ll p$ is the regime where the eccentricity expansion is most reliable.