Vous êtes sur la page 1sur 8

the greatest common divisor (gcd), also known as the greatest common factor (gcf), or highest common factor

(hcf), of two or more non-zero integers, is the largest positive integer that divides the numbers without a remainder. For example, the GCD of 8 and 12 is 4.

Example
The number 54 can be expressed as a product of two other integers in several different ways:

Thus the divisors of 54 are:

Similarly the divisors of 24 are:

The numbers that these two lists share in common are the common divisors of 54 and 24:

The greatest of these is 6. That is the greatest common divisor of 54 and 24. One writes:

]Reducing fractions The greatest common divisor is useful for reducing fractions to be in lowest terms. For example, gcd(42, 56) = 14, therefore,

The greatest common divisor of a and b is written as gcd(a, b), or sometimes simply as (a, b). For example, gcd(12, 18) = 6, gcd(4, 14) = 2. Two numbers are called relatively prime, or coprime if their greatest common divisor equals 1. For example, 9 and 28 are relatively prime. A geometric view For example, a 24-by-60 rectangular area can be divided into a grid of: 1-by-1 squares, 2-by-2 squares, 3-by-3 squares, 4-by-4 squares, 6-by-6 squares or 12-by-12 squares. Therefore, 12 is the greatest common divisor of 24 and 60. A 24-by-60 rectangular area can be divided into a grid of 12-by-12 squares, with two squares along one edge (24/12 = 2) and five squares along the other (60/12 = 5).

Using prime factorizations


Greatest common divisors can in principle be computed by determining the prime factorizations of the two numbers and comparing factors, as in the following example: to compute gcd(18, 84), we find the prime factorizations 18 = 2 3 and 84 = 2 3 7 and notice that the "overlap" of the two expressions is 2 3; so gcd(18, 84) = 6. In practice, this method is only feasible for small numbers; computing prime factorizations in general takes far too long. Here is another concrete example, illustrated by a Venn diagram. Suppose it is desired to find the greatest common divisor of 48 and 180. First, find the prime factorizations of the two numbers: 48 = 2 2 2 2 3, 180 = 2 2 3 3 5. What they share in common is two "2"s and a "3":
2 2

Least common multiple = 2 2 2 2 3 3 5 = 720 Greatest common divisor = 2 2 3 = 12.

Using Euclid's algorithm A much more efficient method is the Euclidean algorithm, which uses the division algorithm in combination with the observation that the gcd of two numbers also divides their difference: divide 48 by 18 to get a quotient of 2 and a remainder of 12. Then divide 18 by 12 to get a quotient of 1 and a remainder of 6. Then divide 12 by 6 to get a remainder of 0, which means that 6 is the gcd. Formally, it can be described as: gcd(a,0) = a

Which also could be written as gcd(a,0) = a gcd(a,b) = gcd(b,a mod b). Other methods If a and b are not both zero, the greatest common divisor of a and b can be computed by using least common multiple (lcm) of a and b:

Keith Slavin has shown that for odd a 1:

which is a function that can be evaluated for complex b. Wolfgang Schramm has shown that

[1]

is an entire function in the variable b for all positive integers a where cd(k) is Ramanujan's sum. Marcelo Polezzi has shown that:

[2]

for positive integers a and b. Donald Knuth proved the following reduction: gcd(2a 1,2b 1) = 2gcd(a,b) 1 for non-negative integers a and b, where a and b are not both zero.
[4]

[3]

More generally

which can easily be proven by considering the Euclidean algorithm in base n.

In arithmetic and number theory, the least common multiple (also called the lowest common multiple or smallest common multiple) of two integers a and b, usually denoted by LCM(a, b), is the smallest positive integer that is a multiple of both a and b.[1] It is familiar from grade-school arithmetic as the "lowest common denominator" that must be determined before two fractions can be added. This definition may be extended to rational numbers a and b: the LCM is the smallest positive rational number that is an integer multiple of both a and b. (In fact, the definition may be extended to any two real numbers whose ratio is a rational number.) If either a or b is 0, LCM(a, b) is defined to be zero. The LCM of more than two integers or rational numbers is well-defined: it is the smallest number that is an integer multiple of each of them.

Examples
[edit]Integer What is the LCM of 4 and 6? Multiples of 4 are: 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76... and the multiples of 6 are: 6, 12, 18, 24, 30, 36, 42, 48, 54, 60, 66, 72, ... Common multiples of 4 and 6 are simply the numbers that are in both lists: 12, 24, 36, 48, 60, 72, .... So the least common multiple of 4 and 6 is the smallest one of those: 12 [edit]Rational What is the LCM of The multiples of and ?

are:

and the multiples of

are:

Therefore, their LCM is lists. What is the LCM of The multiples of and ?

the smallest number on both

are:

and the multiples of

are:

So their LCM is

Note that, by definition, if a and b are two rationals (or integers), there are integers m and n such that LCM(a, b) = m a = n b. This implies that m and n are coprime; otherwise they could be divided by their common divisor, giving a common multiple less than the least common multiple, which is absurd. The above examples illustrate this fact. [edit]Applications When adding, subtracting, or comparing vulgar fractions, it is useful to find the least common multiple of the denominators, often called the lowest common denominator, because each of the fractions can be expressed as a fraction with this denominator. For instance,

where the denominator 42 was used because it is the least common multiple of 21 and 6. [edit]Computing [edit]Reduction

the least common multiple

by the greatest common divisor

The following formula reduces the problem of computing the least common multiple to the problem of computing the greatest common divisor (GCD):

This formula is also valid when exactly one of a and b is 0, since gcd(a, 0) = |a|. There are fast algorithms for computing the GCD that do not require the numbers to be factored, such as the Euclidean algorithm. To return to the example above,

Because gcd(a, b) is a divisor of both a and b, it's more efficient to compute the LCM by dividing before multiplying:

This reduces the size of one input for both the division and the multiplication, and reduces the required storage needed for intermediate results (overflow in the ab computation). Because gcd(a, b) is a divisor of both a and b, and thus the division will be guaranteed to yield an integer, so the intermediate result can be stored in an integer. Done this way, the previous example becomes:

least common multiples by prime factorization


[edit]Finding The unique factorization theorem says that every positive integer greater than 1 can be written in only one way as a product of prime numbers. The prime numbers can be considered as the atomic elements which, when combined together, make up a composite number. For example:

Here we have the composite number 90 made up of one atom of the prime number 2, two

atoms of the prime number 3 and one atom of the prime number 5. This knowledge can be used to find the lcm of a set of numbers. Example: Find the value of lcm(8,9,21). First, factor out each number and express it as a product of prime number powers.

The lcm will be the product of multiplying the highest power in each prime factor category together. Out of the 4 prime factor categories 2, 3, 5, and 7, the highest powers from each are 23, 32, 50, and 71. Thus,

This method is not as efficient as reducing to the greatest common divisor, since there is no known general efficient algorithm for integer factorization, but is useful in illustrating concepts. This method can be illustrated using a Venn diagram as follows. Find the prime factorization of each of the two numbers. Put the prime factors into a Venn diagram with one circle for each of the two numbers, and all factors they

share in common in the intersection. To find the LCM, just multiply all of the prime numbers in the diagram. Here is an example: 48 = 2 2 2 2 3, 180 = 2 2 3 3 5, and what they share in common is two "2"s and a "3":

Least common multiple = 2 2 2 2 3 3 5 = 720 Greatest common divisor = 2 2 3 = 12 This also works for the greatest common divisor (GCD), except that instead of multiplying all of the numbers in the Venn diagram, one multiplies only the prime factors that are in the intersection. Thus the GCD of 48 and 180 is 2 2 3 = 12.

http://en.wikipedia.org/wiki/Least_common_multiple

Vous aimerez peut-être aussi