I have quite a tricky function that I'd like to better understand under which conditions it would converge to a fixed point. It can be best described as: repeatedly subtracting the lower of two numbers from the higher one, adding that amount to the lower number.
$$ f(a, b) = \begin{cases} 2a , & b-a & \text{if $ab$} \\ a , & b & \text{otherwise} \\ \end{cases} $$
Assume $a$ and $b$ are both positive.
So, as an example loop $f(5,7) \to f(10,2) \to f(8,4) \to f(4,8) \to \dots$ (never converges).
A convergent example: $f(1,7) \to f(2,6) \to f(4,4) \to f(4,4) \to \dots$ (converged).
Thus far, I have the following insights:
- if $a+b$ is odd, $f(a,b)$ never converges.
- The convergence of $f(a,b)$ is analogous to the convergence of $f(\frac{a}{gcd(a, b)},\frac{b}{gcd(a, b)})$.
- If $a=0$ or $b=0$ or $a=b$, then $f(a,b)$ is trivially converged.
What's the best way to approach something like this?