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 22 * Problem statement and explanation: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
33 *
44 * 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
719 */
820
921/**
@@ -57,4 +69,3 @@ const extendedEuclideanGCD = (arg1, arg2) => {
5769}
5870
5971export { extendedEuclideanGCD }
60- // ex
You can’t perform that action at this time.
0 commit comments