Artificial intelligent assistant

Two moons orbiting at different speeds. Formula for when they coincide I write science fiction and am trying to figure out how often two (or more) moons would be on the same side of a planet when orbiting at different speeds, if their days to orbit are known. Is there a simple formula for this? Thanks.

I'm not sure exactly what you mean by "on the same side".

For simplicity let's suppose the moons are in circular orbits, so their motions are uniform on the circle, in the same plane and in the same direction, with periods $p_1 < p_2$. At time $t$ they are at angular positions $\theta_1(t) = \theta_1(0) + 2 \pi t/p_1$ and $\theta_2(t) = \theta_2(0) + 2 \pi t/p_2$. The angle between them is $\theta_1(t) - \theta_2(t) = A + B t$ where $A = \theta_1(0) - \theta_2(0)$ and $B = 2 \pi (1/p_1 - 1/p_2)$. The time between conjunctions (when they are in the same direction) is $$C = 2 \pi/B = 1/(1/p_1 - 1/p_2) = p_1 p_2/(p_2 - p_1)$$
Time $C/2$ after a conjunction, they are in opposition (in opposite directions).

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 85d1ed67f04db4b757be53471e40ba67