File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 2
2
* Problem statement and explanation: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
3
3
*
4
4
* This algorithm plays an important role for modular arithmetic, and by extension for cyptography algorithms
5
- *
6
- * This implementation uses an iterative approach to calculate
5
+ *
6
+ * Basic explanation:
7
+ * The Extended Euclidean algorithm is a modification of the standard Euclidean GCD algorithm.
8
+ * It allows to calculate coefficients x and y for the equation:
9
+ * ax + by = gcd(a,b)
10
+ *
11
+ * This is called Bézout's identity and the coefficients are called Bézout coefficients
12
+ *
13
+ * The algorithm uses the Euclidean method of getting remainder:
14
+ * r_i+1 = r_i-1 - qi*ri
15
+ * and applies it to series s and t (with same quotient q at each stage)
16
+ * When r_n reaches 0, the value r_n-1 gives the gcd, and s_n-1 and t_n-1 give the coefficients
17
+ *
18
+ * This implementation uses an iterative approach to calculate the values
7
19
*/
8
20
9
21
/**
@@ -57,4 +69,3 @@ const extendedEuclideanGCD = (arg1, arg2) => {
57
69
}
58
70
59
71
export { extendedEuclideanGCD }
60
- // ex
You can’t perform that action at this time.
0 commit comments