I am a total beginner to doing this kind of math, so there is a mean learning curve.
There is need to calculate the number of seconds from when mercury is direct to the next direct phase. My thoughts about doing this:
speed of mercury = 170496, speed of earth = 107226
days for mercury to complete 87.9691, days for earth to complete 365.25
distance mercury travels = speed * days, distance earth travels = speed * days
Since mercury completes in 87 days and earth completes in 365 days, need to calculate the difference of earths travel.
offset distance = earth speed * days for mercury.
difference + offset distance
since the two circles (earths orbit & mercury orbit) are different sizes, need to calculate the difference between the two circles.
Would I want to multiply the distance mercury travels with the difference of the two orbits?
and here is where I get lost. My formula comes out with a wrong offset of six days.
Is there a better way to calculate what I want?
If you could be clear about how to solve the problem, that would be great.
One can compute this time referring only to orbital periods and not to distances, at least to a first-order approximation that assumes that both orbits are circular and coplanar.*
Let $\omega_M$ and $\omega_E$ denote the angular frequencies of Mercury and Earth, respectively. Then, the (constant) rate of change of the Mercury-Sun-Earth angle $\theta$ is $\omega_M - \omega_E$, and so at time $t$ after an opposition (where all three bodies are in a line, with the Sun in the middle) that angle is $$\theta = (\omega_M - \omega_E) t.$$ The next opposition after the one at time $t = 0$ occurs at the time $T$ when $\theta = 2\pi$, that is, at time $$T = \frac{2\pi}{\omega_M - \omega_E} .$$
More or less by definition, the angular velocity $\omega_A$ of the (circular) orbit of a body $A$ and its orbital period $T_A$ are related by $\omega_A = \frac{2\pi}{T_A}$. Substituting in the above formula, simplifying, and substituting the values $$T_M=87.97\,\textrm{d} \qquad \textrm{and} \qquad T_E=365.26\,\textrm{d}$$ gives that the time between successive oppositions is $$\boxed{T = \frac{T_M T_E}{T_E - T_M} \approx 115.88\,\textrm{d}} .$$
*The orbit of Mercury is noticeably noncircular: Its eccentricity is $e_M = 0.206$---by far the largest among the eight planets. This makes Mercury's speed at perihelion (its closest point to the sun) $$\frac{1 + e_M}{1 - e_M} \approx 1.53$$ times its speed at aphelion (the farthest point). So both Mercury's linear and angular velocity are far from constant, causing some variation in the duration of retrograde: It's shorter when Mercury is in opposition near perihelion and longer when it is in opposition near aphelion. For example, the three retrogrades of Mercury in 2021 have durations $21.38\,\textrm{d}$, $23.98\,\textrm{d}$, and $21.42\,\textrm{d}$. As a consequence, the time between the starts of Mercury's successive retrogrades varies some, too.