Professional Documents
Culture Documents
Extended Euclid PDF
Extended Euclid PDF
Example 1: m = 65, n = 40
Step 1: The (usual) Euclidean algorithm:
(1)
(2)
(3)
(4)
65
40
25
15
10
=
=
=
=
=
1 40
1 25
1 15
1 10
25
+
+
+
+
25
15
10
5
5 = 15 10
(3)
= 15 (25 15)
= 2 15 25
(2)
= 2 40 3 25
= 2(40 25) 25
(1)
= 2 40 3(65 40) = 5 40 3 65
1239
735
504
231
42
=
=
=
=
=
1 735
1 504
2 231
5 42
2 21
+
+
+
+
504
231
42
21
21 = 231 5 42
(3)
= 11 231 5 504
(2)
= 11 735 16 504
(1)