Name for this Algorithm

algorithmsdivisibilityeuclidean-algorithm

I've managed to prove a bunch of properties about this algorithm that I came up with. I'm now curious to know it's name to see what other people have done.

Given a number in base b $$N_0 = b N_X + N_L, \qquad 0 \leq N_L \leq b-1 $$
And a divisor also in base b $$D = b D_X + D_L, \qquad 0 \leq D_L \leq b-1 $$

($N_L$ and $D_L$ are the last digits of N and D)

Then compute $$N_{i+1} = \left| \begin{matrix} N_X & N_L \\ D_X & D_L \end{matrix} \right|$$

I've shown this algorithm to a few lecturers at my uni and they don't know a name for it but suspect it is some sort of variation on the Euclidean Algorithm.

It can be used for divisibility tests (especially good in binary, if $D_L = 1$, or if $D$ is prime )

E.g. Does $9734$ divide by $31$

$N_X = 973$, $N_L = 4$

$D_X=3$, $D_L = 1$

$$N_0 = 9734$$

$$N_1 = \left| \begin{matrix} 973 & 4 \\ 3 & 1 \end{matrix} \right| = 961$$
$$N_2 = \left| \begin{matrix} 96 & 1 \\ 3 & 1 \end{matrix} \right| = 93$$
$$N_3 = \left| \begin{matrix} 9 & 3 \\ 3 & 1 \end{matrix} \right| = 0$$

If the algorithm hits $0$, then $D|N$ (Under certain conditions, counter example N=48, D=36)

Also, if $D_L = 1$ the quotient appears

$$N_1 = \left| \begin{matrix} 973 & \color{red}{4} \\ 3 & 1 \end{matrix} \right| = 961$$
$$N_2 = \left| \begin{matrix} 96 & \color{red}{1} \\ 3 & 1 \end{matrix} \right| = 93$$
$$N_3 = \left| \begin{matrix} 9 & \color{red}{3} \\ 3 & 1 \end{matrix} \right| = 0$$

$9734 = \color{red}{314} \times 31$

Any help is greatly appreciated! Thanks, Ben

Best Answer

It's the special case $m = 10c\!+\!d,\ n = 10a\!+\!b\ $ of the following

$\quad \bbox[5px,border:1px solid red]{(a,n) = 1\,\Rightarrow\, (m,n) = (am\!-\!cn,n)}\ \ $ by $\,(m,n)=(am,n) = (am\!-\!cn,n)$

So $\ (a,b)=1\,\Rightarrow\, (10c\!+\!d,10a\!+\!b) = (ad\!-\!bc,10a\!+\!b),\ $ exactly as you observed.

Remark $ $ Various well-known divisibity test rules are essentially special cases of this, e.g. the rule for divisibility by $7$ follows from the rule for $21$ given below (we negated $\,ad\! -\! bc = 2d\!-\!c\,$ below)

$\qquad\qquad \qquad\ \ \ \, (10c\!+\!d,10(2)\!+\!1) = (c\!-\!2d, 10(2)\!+\!1)$

${\rm similar\ to\ your}\ \ (10c\!+\!d,10(3)\!+\!1) = (c\!-\!3d, 10(3)\!+\!1)\ $ rule for $\,31$