Solution (source code)

= Solution

Use conventional <mean longitudes> $\lambda$ and take the positive integers $p,q$ in lowest terms. Rotational invariance requires the angular coefficients of a <resonant argument> to sum to zero. Since the inner <planet> has zero <orbital eccentricity>, the eccentricity-type term involving its undefined apsidal angle has zero amplitude. The surviving outer-eccentricity argument is
$$
\boxed{\phi_{bc}=(p+q)\lambda_c-p\lambda_b-q\varpi_c\pmod{2\pi}}.
$$
Its leading <disturbing function> term is proportional to $e_c^q\cos\phi_{bc}$. Near the period commensurability, $(p+q)n_c-pn_b$ is small, so the <resonant argument> is slow and repeated perturbations can add coherently. Trapping produces <resonant-argument libration>, rather than circulation, with $(p+q)n_c-pn_b-q\dot\varpi_c\simeq0$.

A near-integer period ratio alone does not prove <mean-motion resonance>: the diagnostic is bounded <resonant-argument libration>. At $e_c=0$ this eccentric resonant term vanishes and $\varpi_c$ is undefined. If $p,q$ have a common factor, reduce the ratio first; the unreduced $q$ is not the actual lowest resonance order.