 If we put all of our basic observations on divisibility together, we arrive at what's called the Euclidean Algorithm. And so let's put those together, the Euclidean Algorithm. If I want to find the greatest common divisor of two numbers, then what I can do is divide the larger number by the smaller number to find some remainder, whatever that happens to be. And then I'm going to divide the previous divisor by the remainder to get another remainder. And I'm going to continue dividing by each remainder to find new remainders. And if I keep doing this, the last non-zero remainder I get is going to be the greatest common divisor of the original two numbers. Now, that's the thing that makes this an algorithm where if we continue to apply this mindlessly, we will eventually arrive at the greatest common divisor. However, because we are somewhat smarter than a cheap pocket calculator, we might make the observation that the greatest common divisor, whatever it is, is also going to be a divisor of all of the remainders. So I could find my greatest common divisor among the divisors of the first remainder, or if not, I could find the greatest common divisor among the divisors of the second, and so on. And again, we can think about the divisors of each of these remainders as candidates for the greatest common divisor, and we then just need to check which candidates work. So for example, find the greatest common divisor of 3,293 and 1,591. And again, we can treat this as a problem in adaptive expertise. In other words, if you can look at these two numbers and immediately come up with what the prime factorization is going to be, and you can look at this number and immediately come up with the prime factorization, then you can use the prime factorization method of finding the greatest common divisor. On the other hand, if you're like me and most everybody else on the planet, you look at these two numbers and can't immediately see what a prime factor of these numbers is, you might want to try something else. And so in this case, our something else is the Euclidean Algorithm. So we'll start out, we'll divide the larger number by the smaller number. And one nice visual for applying the Euclidean Algorithm, we can think about the next quotient as being sort of a slide. So what's going to happen is this previous divisor is going to slide over and become the dividend. This previous remainder is going to slide over and become the new divisor. And so there's my slide quotient. We don't care about the quotient, but we do care about what the remainder is. And again, we'll slide the divisor over to become the new dividend. We'll slide the remainder over to become the new divisor. And again, we do the division, get our quotient, who cares, and our remainder. And because we have a remainder of zero that tells us, among other things, we have to stop because we can't slide this over and get our zero as our divisor. And since 37 is the last non-zero remainder, then 37 is going to be the greatest common divisor of these two numbers. And again, the thing that makes us an algorithm is that if we apply this algorithm mindlessly like a computer would be programmed to do, we will eventually arrive at the greatest common divisor. Last remainder is zero, so previous remainder is the greatest common divisor. On the other hand, because we are smarter than a computer, we can actually take some shortcuts. So let's take another problem, find the greatest common divisor of these two numbers. And again, you might look at this number and immediately come up with a nice prime factorization for it. And then this number might take you a little bit longer as that's a somewhat more complicated number to figure out. But again, I can still start by dividing the larger number by the smaller number, get a quotient, who cares, and find the remainder, 560. Now, the thing that's worth noting here is 560 is a number that we can easily factor. And the observation that we can make, two and five, don't divide the second number, which means that no divisor that includes a two or a five can possibly be a common divisor of these two. So we'll ignore the twos, we'll ignore the fives, and the only thing that's left is going to be the seven. So we do verify seven does actually divide this, 777, it divides 560, and so it has to divide 3,668. And again, the candidates for the common divisor are things that divide any of the remainders. And seven is the largest number, is the largest of the candidates that will also divide the two originals. So that tells me that seven is going to be the greatest common divisor. Well, let's say I didn't notice that. Let's say I didn't notice that 560 factored this way, or I didn't want to go through that problem of factorization. No problem. So old divisor becomes new dividend, old remainder becomes new divisor, and I can continue the Euclidean algorithm. So again, divisor remainder becomes the new quotient. Again, who cares what the actual quotient is, what we care about is what the remainder is. And again, we can consider this remainder 217 as seven times 31 and make the same observation. Seven does divide this, so it also divides this. 31 doesn't divide 777, so can't include 31 in any common divisor of the two numbers. And again, if we didn't want to factor 217, or if we found it too difficult to factor, we can continue to apply the Euclidean algorithm. Again, old divisor becomes new dividend, old remainder becomes new divisor, and I get to my next step. And again, maybe this is too difficult to factor, or I don't want to bother, so old divisor becomes new dividend, old remainder becomes new divisor, and again, quotient, don't care about that, but do care about the remainder. And again, sliding the divisor and remainder over gets us to our next step. And again, 35, easy to factor, so again, I have two candidates for my greatest common divisor. Five doesn't work, seven does, and so on. And again, if I didn't notice that, or if I didn't want to, we could do the slide. 91 divided by 35, and again, and again, and again, and again, remainder zero tells me that my previous remainder is going to be the greatest common divisor of the two numbers. And again, what makes this an algorithm is if I keep applying it, eventually I arrive at what the greatest common divisor is. There is a guaranteed arrival point. And because of this, this is something that's easy to program a computer to do, because a computer will just follow the steps mindlessly, arrive at the end, and report that seven, the last non-zero remainder, is the greatest common divisor. What makes human beings slightly more adept at the least things than computers is we can stop any time we want to. And we might stop here and look for our greatest common divisor among the divisors of 560, or maybe stop here and look for the greatest common divisor among the divisors of 217, and so on. We don't have to go all the way to the end at any point where we deem that we have a number that's easy to work with. We can stop at that point and look for our greatest common divisor.