Suppose that, after running the Euclidean algorithm on two integers $a$ and $b$, we find that $r_n=3$, where $r_n$ is the last remainder in the Euclidean algorithm. Furthermore, we find that $r_{n-1}=6$ and $r_{n-2}=21$. What can we say about $a$ and $b$?
Obviously, by the definition of the Euclidean algorithm, $\gcd(a, b)=3$. However, that isn't sufficient (isn't strong enough for an iff condition). I tried for a long time to think of more conditionns, but only came up with a bunch of false conjectures. Can someone help me?
As described in this answer, we can apply the Extended Euclidean Algorithm to $21$ and $6$ as follows: $$ \begin{array}{r} &&\overset{\substack{\hspace{-1in}\left\lfloor\frac{21}6\right\rfloor\hspace{-1in}\\\downarrow\\[3pt]\,}}{3}&\overset{\substack{\hspace{-1in}\left\lfloor\frac63\right\rfloor\hspace{-1in}\\\downarrow\\[3pt]\,}}{2}\\\hline 0&1&-3&7\\ 1&0&1&-2\\ 21&6&3&0\\ \end{array} $$ Thus, the terminal three remainders, $(21,6,3)$, dictate and are dictated by the last two terms, $(3,2)$, in the continued fraction (along with the common factor of $3$). In fact, $(3;2)$ is the continued fraction for $\frac72=\frac{21}6$.