This website finds the GCD using the Euclidean algorithm or finds a linear combination of the GCD using the extended Euclidean algorithm. All steps/work done is also shown.
- Two numbers are given that are not negative. Initially, R1 will be the greater of the two numbers and R2 will be the lesser of the two.
- The max value that makes (R2 * Q) ≤ R1 where Q is some integer, that will be the value of Q.
- If there is a remainder, the remainder is R.
- If the remainder is not 0, it proceeds to the next row. The new R1 takes on the value of the previous R2 and the new R2 takes on the previous value of R.
- This process is repeated until the remainder is 0.
- When the remainder is 0, R2 will be the GCD.
- Two numbers are given that are not negative. Initially, R1 will be the greater of the two numbers and R2 will be the lesser of the two.
- Other Initial values will be S1=1, S2=0, T1=0, T2=1.
- The max value that makes (R2 * Q) ≤ R1 where Q is some integer, that will be the value of Q.
- If there is a remainder, the remainder is R.
- S= S1 - S2 * Q and T= T1 - T2 * Q.
- If the remainder is not 0, it proceeds to the next row. The new R1 takes on the value of the previous R2, the new R2 takes on the previous value of R, the new S1 takes on the previous value of S2, the new S2 takes on the previous value of S, the new T1 takes on the previous value of T2, and the new T2 takes on the previous value of T.
- This process is repeated until the remainder is 0.
- When the remainder is 0, R2 will be the GCD, S2 will be S, T2 will be T.
- Now, let X,Y be the two initially selected where X > Y. (X * S) + (Y * T) = GCD.
- HTML
- CSS
- JavaScript
This project is licensed under the MIT License - see the LICENSE file for details