Divisibility, Factors and Euclid's Algorithms
An outline of the fundamentals of number theory
Last updated
An outline of the fundamentals of number theory
Last updated
Cryptography is built on the foundations of algebra and number theory, which we will hopefully cover well enough here.
is said to be divisible by if there is another integer such that . In this case, is said to be a factor of . This is denoted by if divides , and if it does not.
Given two integers and , the greatest common divisor (also known as the highest common factor) is the largest integer where and .
Given and , we can write an equation linking the two:
Where and are integers which fit the equation with . Basically, divides into a maximum of times with a remainder of . But here's where the trick lies.
Every term added together in that equation must be divisible by because if we treat the gcd as we can say that :
This is quite a leap forward which will require a bit of thinking, but let's break it down algebraically:
I highly recommend you think about this for a bit until it makes sense to you, and make sure to use other resources if it helps!
And now we attempt to calculate the GCD of 8075 and 133.
Therefore the GCD of 16283 and 8075 is 19.
This extension of the algorithm is invaluable for calculating modular inverses of numbers and is based on using the Euclidean Algorithm to calculate the GCD then writing it in terms of other numbers, repeating the process for the smallest non-GCD number until we reach an equation with only the GCD and the two starting numbers. Let's work with the example above, writing an equation for the GCD:
Now 38 is the smallest non-GCD number, and we can write it in terms of the larger number in the sequence of equations written in the example, then repeat for the next smallest:
Meaning has to be some integer multiple of .
But now, if we think outside the box, we realise that both and are divisible by ... so we can just calculate !
And so on. But when does it stop? When do we stop taking the GCD? Well we can stop taking the GCD once , in which case and as a result we can take as the GCD!
Let’s say we want to find the GCD of 8075 and 16283. First, we can write it in the form :
We can take the Euclidean Algorithm a step further and calculate, in addition to the GCD, for which sum to the GCD, i.e.
Therefore our equation is as follows: