Euclidean Algorithm
Last updated
Last updated
Although we have functions that can compute our easily it's important enough that we need to give and study an algorithm for it: the euclidean algorithm.
It's extended version will help us calculate modular inverses which we will define a bit later.
Important Remark
If and then . Therefore
We write the following:
Or iteratively until we find a . Then we stop
Now here's the trick:
Pause and ponder. Make you you understand why that works.
Example:
Code
Exercises:
Implement the algorithm in Python / Sage and play with it. Do not copy paste the code
This section needs to be expanded a bit.
Bezout's identity
If then divides
Calculate
Pick 2 numbers and calculate their by hand.
Let . Then there exists such that
The extended euclidean algorithm aims to find given