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(13, 8) :

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 13 8 1 0 0 1
1 8 13 0 1 1 0 5 4 8 14 4 7
2 4 13 4 7 1 0 9 2 12 20 6 10
3 2 13 6 10 1 0 11 1 Even Even 3 5
4 1 13 3 5 1 0 12 1 4 5 4 5 6 12 18 6 9
5 6 1 6 9 3 5 5 3 14 22 7 11
6 3 1 7 11 3 5 2 0 10 16 2 3 1 10 16 5 8
7 1 1 5 8 3 5 0
(5)(13) - (8)(8) = 1