The greatest common factor ( GCF ) is a mathematical term. Its counterpart is the least common multiple (LCM) . Both play a role in fractions and number theory , among other things .
It is the greatest natural number that can be used to divide two whole numbers without a remainder .
The two integers and is an integer with the property that they divider both of and by and that any integer, which is also the numbers and divides, in turn divides is. With the ring of whole numbers (which has a total order >) one normalizes the to the largest whole such number .
The term “large” in correlates to a high degree with the usual order relation > of whole numbers. There is, however, one important exception: Since the multiple of any whole number is, in questions of divisibility, “size” cannot be beaten. This view is in line with the association's conception (and ideal theory ) and simplifies some of the calculation rules listed below.
The English term gcd (greatest common divisor) for is also common in mathematical texts.
Often used as a shorthand for .
- 12 is divisible by the following numbers without a remainder: 1, 2, 3, 4, 6, 12.
- 18 has these factors: 1, 2, 3, 6, 9, 18.
- So the common factors (divisors) of 12 and 18 are 1, 2, 3, 6 and the largest of these is 6; in characters:
Calculation using prime factorization
GgT and LCM can be determined by the prime factorization of the two given numbers. Example:
For the GCF one takes the prime factors that occur in both decompositions and, as the associated exponent, the respective smaller of the output exponents:
Euclidean and Stein's Algorithm
The calculation of the prime factorization of large numbers and thus also the determination of the greatest common divisor according to the above method is very complex. However, the Euclidean algorithm is an efficient method to calculate the greatest common divisor of two numbers. This method was further varied by Stein's algorithm . Whether or not this is an improvement depends on the evaluation function and "machinery" that executes the respective algorithm.
The classical Euclidean algorithm calculates the greatest common divisor by looking for a common “measure” for the lengths of two lines. To do this, the smaller of two lengths is subtracted from the larger and this step is repeated with the result and the smaller length until the subtracted number is identical to the result. Example:
The greatest common divisor is thus 13. If you know that 13 is prime, you could already read the divisor in the example in the second step, since a prime number cannot be divided any further as a result.
In the modern Euclidean algorithm, division by remainder is carried out in successive steps , with the remainder becoming the new divisor in the next step. The divisor that results in remainder 0 is the greatest common divisor of the original numbers. Example:
So 252 is the greatest common factor between 3780 and 3528.
In C the algorithm is formulated as follows:
int GreatestCommonDivisor(int a, int b)
if (a == 0) return abs(b);
if (b == 0) return abs(a);
h = a % b;
a = b;
b = h;
} while (b != 0);
The GCF of several numbers
You use all the prime factors that occur in each of the numbers with the smallest power that occurs, for example:
You could also calculate first and then as a two-digit combination on the natural numbers, the GCF is associative :
This justifies the spelling .
Be , , and whole numbers. Then:
Here referred to the amount of .
The calculation rule mentioned specifically results . This also results from the fact that every integer (even the 0 itself) is a divisor of 0, while conversely 0 does not divide any number other than 0.
Is a common divisor of and , then:
Is ( and are congruent modulo ) then:
If you keep one of the two arguments, then gcd is a multiplicative function , because for relatively prime numbers and applies
Lemma of Bézout
After Lemma Bézout the greatest common divisor of two integers can and as a linear combination of and represent with integer coefficients:
For example, the greatest common factor of and has the following representation:
The coefficients and can be calculated using the extended Euclidean algorithm .
The following applies to even , odd and whole :
If you put a prime number together from two real summands, coprime numbers always apply to them:
When truncating a fraction , a common factor is removed from the numerator and denominator of a fraction, whereby the value of the fraction does not change, e.g. B. . If you abbreviate with the greatest common divisor of the numerator and denominator, a fraction results that cannot be further reduced. For example is so
A fraction that cannot be further reduced is called a reduced fraction or also completely and maximally reduced fraction .
Relationship between GCD and the least common multiple
Further algebraic structures with gcd
The concept of the GCD is based on the concept of divisibility as it is defined in rings. When discussing the GCD, one restricts oneself to zero divisor-free rings, in the commutative case these are the integrity rings .
An integrity ring in which two elements each have a GCD is called a GCD ring or GCD area . (In a GCB ring, every two elements also have a LCM.)
In general, such rings do not have a partial order that is antisymmetric like the whole or natural numbers have. Often the divisibility relation , which is a quasi-order, is the only order relation. Therefore, the ggT can be. no longer unambiguously normalize as non-negative, but only determine up to association . Two elements and are associated, in signs , when there is a unity with .
We extend the concept of the GCD to the set of all greatest common factors of the elements of a subset of a ring , formally:
In words: The dividers of are exactly the elements from which all elements from divide. The GCD are associated with each other.
You can z. B. also form for polynomials . Instead of the prime factorization , one takes here the decomposition into irreducible factors:
The polynomial ring in a variable is Euclidean . There is a division with remainder to calculate the .
Gaussian number ring
In the Gaussian number ring , the greatest common divisor of and is even , because and . Strictly speaking, there is only one greatest common factor, since all the numbers associated with this number are also greatest common factors. (The units are .)
In the integrity ring have the elements
no gcd: the elements and are two maximum common factors , because both have the same amount , but these two elements are not associated with each other. So there is no GCF of and .
However, the elements mentioned and have their own GCT, namely . In contrast, they have no LCM, because if one LCM would then follows from the "GCD LCM equation" that to associated needs to be. However, the common multiple is not a multiple of , so there is no LCM and the two elements have no LCM at all.
If is an integrity ring and the elements and have a LCM, then they also have a GCF, and the equation applies
A Euclidean ring is a main ideal ring that is a factorial ring that is ultimately a GCF ring. Likewise, every main ideal ring is a bezout ring , which in turn is always a gcd ring.
An example of a non-commutative ring GCD are the Hurwitzquaternionen .
Analytical number theory
In elementary number theory , the greatest common divisor of two whole numbers is one of the most important basic concepts. You write there regularly and mean the positive GCD, so you assume .
In analytical number theory , the gcd function can be analytically continued in a variable for a whole function . → See Ramanujan sum .
↑ Peter Bundschuh: Introduction to Number Theory . 6th edition. Springer, Berlin 2008, ISBN 978-3-540-76490-8 , p. 15.