Added a short explanation of the Ext Euc Algo

This commit is contained in:
VinWare
2021-10-21 18:31:39 +05:30
parent 79c7ce45c8
commit e92e2e3926

View File

@ -2,8 +2,20 @@
* Problem statement and explanation: https://en.wikipedia.org/wiki/Extended_Euclidean_algorithm
*
* This algorithm plays an important role for modular arithmetic, and by extension for cyptography algorithms
*
* This implementation uses an iterative approach to calculate
*
* Basic explanation:
* The Extended Euclidean algorithm is a modification of the standard Euclidean GCD algorithm.
* It allows to calculate coefficients x and y for the equation:
* ax + by = gcd(a,b)
*
* This is called Bézout's identity and the coefficients are called Bézout coefficients
*
* The algorithm uses the Euclidean method of getting remainder:
* r_i+1 = r_i-1 - qi*ri
* and applies it to series s and t (with same quotient q at each stage)
* When r_n reaches 0, the value r_n-1 gives the gcd, and s_n-1 and t_n-1 give the coefficients
*
* This implementation uses an iterative approach to calculate the values
*/
/**
@ -57,4 +69,3 @@ const extendedEuclideanGCD = (arg1, arg2) => {
}
export { extendedEuclideanGCD }
// ex