While working on linked question, I encountered recurrence relation of form: $$ a_{n+2}=a_n\operatorname{mod}a_{n+1},\quad a_0=A,\quad a_1=B, $$ where $A,B-$positive integers, $A<B$.
I wonder if there exists a technique to get general term, few terms before $a_n$ turns into $0$, or at least number of iterations before $a_n$ turns into $0$.