X = 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
Y = 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
X ↔ Y

Ext-GCD(8, 13) :

i GCD Bezout AOdd : AEven :
A B ax ay bx by |A-B| A↔B Sx Sy ax
Sx'
ay
Sy'
A
A/2
ax
ax + Y
ay
ay + X
ax
ax/2
ay
ay/2
0 8 13 1 0 0 1
1 8 13 1 0 0 1 5 4 14 8 7 4
2 4 13 7 4 0 1 9 2 20 12 10 6
3 2 13 10 6 0 1 11 1 Even Even 5 3
4 1 13 5 3 0 1 12 1 5 4 5 4 6 18 12 9 6
5 6 1 9 6 5 3 5 3 22 14 11 7
6 3 1 11 7 5 3 2 0 16 10 3 2 1 16 10 8 5
7 1 1 5 3 8 5 0
(5)(8) - (3)(13) = 1