Sums of remainders in Euclidean GCD algorithm

144 Views Asked by At

I've noticed that when going through the steps of Euclidean GCD algorithms, very often the sum of the remainders in the steps $s_{i+1}$ and $s_{i+2}$ will be equal to the remainder in step $s_i$. However, this isn't always the case.

Example

To illustrate what I'm talking about consider this:

$$ gcd(612,93):\\ \begin{align*} s_1: 612 &= 6 \times 93 + 54 \\ s_2: 93 &= 1 \times 54 + 39 \\ s_3: 54 &= 1 \times 39 + 15 \\ s_4: 39 &= 2 \times 15 + 9 \\ s_5: 15 &= 1 \times 9 + 6 \\ s_6: 9 &= 1 \times 6 + 3 \\ s_7: 6 &= 2 \times 3 + 0 \end{align*} $$

Notice how $54=39+15$, $15=9+6$, $9=3+6$, but $39 \neq 15+9$.

Question

Is there any reason for this to happen? How to tell if the remainder will not be the sum of the remainders in two subsequent steps?

1

There are 1 best solutions below

5
On BEST ANSWER

Hint: Note that this happens when you get a $1$ for a quotient. For example, it's right there in the lines $54=1\times 39+15,\, 15=1\times 9+6,\,9=1\times 6+3$. If you think of $93$ as the first remainder, then $93=1\times 54+39$.

Then the question is "why do you so often get a quotient of $1$?" This is a result of random processes. If the remainder after division: $a=bq+r$, is roughly random between $0$ and $b-1$, then the next term $b=rq_2+r_2$ will have quotient $q_2=1$ roughly 1/2 of the time - whenever $2r>b$.