When will A and B meet? There are two racers $A$ and $B$.   


*

*speed of A: $1$ nodes/sec   

*Speed of B: $2$ nodes/sec


Both of them race in a circular track as shown.

After how many seconds will the two racers meet again? How to derive a mathematical expression for the same?
I was trying using LCM but did not get a generalized expression for different speed and nodes.
 A: Let $n$ be the number of seconds commenced. Then $A$ will be on the spot labeled $n \mod8$ and $B$ will be on the spit labeled $2n\mod8$. Then we want to find all values of $n$ such that $n\equiv 2n \mod 8$. This reduces to $7n\equiv0\mod8$. But $ \gcd(7,8)=1$ and therefore $n\equiv0\mod 8$, i.e. $n=8k$ for all natural numbers $k$.
A: Consider it this way. Fold out the track for the first part of this problem so that it's a sort of "flat-world/Pac-Man" 1-D problem. Assign B's start position n nodes away and A's position at 0. So:
$$
\begin{eqnarray} x_A &=& v_A t& \pmod{n}\\
x_B& =& n-v_B t &\pmod{n}
\end{eqnarray}
$$
At the time they meet, the two values are equal. Setting the equations equal to each other and solving for the non-moded n term, we get
$$ n=(v_A+v_B)t\pmod{n}  $$
Now, while this is impossible to solve usually, it's a good thing we're on a circular track. n as a positional value here is equivalent to zero. Substituting 0 for n, you now have an equation that can be solved. This yields a time of 8 seconds for the particular scenario above.
