Difference between revisions of "Greatest common divisor"
(wikify) |
|||
Line 28: | Line 28: | ||
---- | ---- | ||
− | The Euclidean algorithm is much faster and can be used to give the GCD of any two numbers without knowing their prime factorizations. To find the greatest common divisor of more than two numbers, one can use the recursive formula <math> | + | The Euclidean algorithm is much faster and can be used to give the GCD of any two numbers without knowing their prime factorizations. To find the greatest common divisor of more than two numbers, one can use the recursive formula <math>GCD(a_1,\dots,a_n)=GCD(GCD(a_1,\dots,a_{n-1}),a_n)</math>. |
---- | ---- | ||
Line 37: | Line 37: | ||
Using this, you can find the GCD rather quickly if you know the LCM and the two numbers. This equation is also useful for finding one of the numbers if you know the other number, the GCD and the LCM. | Using this, you can find the GCD rather quickly if you know the LCM and the two numbers. This equation is also useful for finding one of the numbers if you know the other number, the GCD and the LCM. | ||
+ | {{wikify}} | ||
+ | |||
+ | [[Category:Number theory]] |
Revision as of 17:43, 24 November 2007
The greatest common divisor (GCD) of two or more integers is the largest integer that is a divisor of all the given numbers.
The GCD is sometimes called the greatest common factor (GCF).
A very useful property of the GCD is that it can be represented as a sum of the given numbers with integer coefficients. From here it immediately follows that the greatest common divisor of several numbers is divisible by any other common divisor of these numbers.
The GCD can be found in two ways. The first way involves factoring the numbers, and the second way uses Euclidean algorithm.
Once the prime factorizations of the given numbers has been found, the greatest common divisor is the product of all common factors of the numbers.
Example:
The common factors are 2 and , so the GCD is
Another Example:
The common factors are and 3, making the GCD .
The Euclidean algorithm is much faster and can be used to give the GCD of any two numbers without knowing their prime factorizations. To find the greatest common divisor of more than two numbers, one can use the recursive formula .
Another useful trick is the equation
Using this, you can find the GCD rather quickly if you know the LCM and the two numbers. This equation is also useful for finding one of the numbers if you know the other number, the GCD and the LCM. Template:Wikify