Two greatest common divisor algorithms of "turn"

Source: Internet
Author: User
Tags gcd greatest common divisor

1. the Euclidean method

The greatest common divisor is a method of finding two natural numbers, also called Euclidean algorithm.
For example, ask for GCD (319,377):
∵377÷319=1 (Yu 58)
∴GCD (377,319) =GCD (319,58);
∵319÷58=5 (Yu 29),
∴GCD (319,58) =GCD (58,29);
∵58÷29=2 (Yu 0),
∴GCD (58,29) = 29;
∴GCD (319,377) =29.

2. More subtractive methods :

More subtractive subtraction is a greatest common divisor algorithm from the nine chapters of arithmetic, originally designed for numerator, but it is suitable for any occasion requiring greatest common divisor.
"Nine Chapters of Arithmetic" is an ancient Chinese mathematics monographs, wherein "more subtractive damage" can be used to seek two number of greatest common divisor, that is, "can half of the half, not half, the sub-denominator, the number of children, in order to reduce less, more subtract loss, and so on." By the number of equal. ”
Translated into modern languages as follows:
The first step: arbitrarily given two positive integers, judging whether they are even. If so, use a 2 reduction, or the second step if not.
The second step: reduce the smaller number by a larger number, and then compare the resulting difference with the smaller number, and subtract the decimal number by the large numbers. Continue this operation until the resulting meiosis and difference are equal.
The product of several 2 and second intermediate numbers in the first step is the desired greatest common divisor

The "equal number", which is said, is greatest common divisor. The method of seeking "equal number" is "more subtractive". So the subtraction method is also called the equivalence algorithm.
Example 1, using the more subtractive loss of 98 and 63 greatest common divisor.
Solution: Because it is not even , the number of 98 and 63 is reduced by a large number and subtracted:
98-63=35
63-35=28
35-28=7
28-7=21
21-7=14
14-7=7
So, the greatest common divisor of 98 and 63 equals 7.
This process can be simply written as:
(98,63) = (35,63) = (35,28) = (7,28) = (7,21) = (7,14) = (7,7) =7.

Example 2, the greatest common divisor of 260 and 104 were obtained with the more subtractive loss technique.
Solution: Since both 260 and 104 are even , first 2 reduction is used to obtain 130 and 52, and then 2 reduction to get 65 and 26.
At this point 65 is odd and 26 is not odd, so subtract 65 and 26:
65-26=39
39-26=13
26-13=13
So, the greatest common divisor of 260 and 104 equals 13 times the first step of about two 2, or 13*2*2=52.
This process can be simply written as:
(260,104) = (65,26) = (39,26) = (13,26) = (13,13) =13. [3]


3. The difference between the Euclidean method and the more subtractive loss technique
(1) are the methods to find the maximum common factor, the calculation of the division-based method to divide the main, more subtractive loss of the main subtraction, the calculation of the number of times the calculation of the method is relatively small, especially when the number of two digital differences between the number of differences more obvious.
(2) from the manifestation of the results, the result of the method is that the dividing remainder is 0, and the subtraction is obtained by the same difference between the meiosis and the differential. [4-5]

4. Common conclusions
When solving the problems related to greatest common divisor and least common multiple, the following conclusions are commonly used:
(1) If two numbers are Inma, then their greatest common divisor is 1, and least common multiple is the product of these two numbers.
For example 8 and 9, they are Inma, so (8,9) =1,[8,9]=72.
(2) If the larger number is a multiple of the smaller number in two numbers, then the smaller number is the greatest common divisor of the two numbers, and the larger number is the least common multiple of the two numbers.
For example 18 with 3,18÷3=6, so (18,3) =3,[18,3]=18.
(3) The two numbers are divided by their greatest common divisor, the quotient of which is Inma.
For example, 8 and 14 are divided by their greatest common divisor 2 respectively, the resulting quotient is 4 and 7, then 4 and 7 are Inma.
(4) The product of two numbers of greatest common divisor and their least common multiple is equal to the product of these two numbers.

Reference documents:
http://blog.163.com/xiaoting_hu/blog/static/5046477220136491243567/

Two greatest common divisor algorithms of "turn"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.