Seeking greatest common divisor by the method of dividing

Source: Internet
Author: User
Tags greatest common divisor integer division

Seeking greatest common divisor by the method of dividing

set two numbers to A, B (b

To find a proof from somewhere:

principle and its detailed proof

Before introducing this method, we explain some of the characteristics of the integer division (all the numbers below are positive integers, no longer repeat), and we can give the definition of the divisible nature:

For two natural numbers a and B, if there is a positive integer q, so that A=BQ, then a can be divisible by B, B is a factor, a is a multiple of B.

If a can be divisible by C and B can be divisible by C, then C is the public factor of A and B (public factor).

From this we can draw the following inference:

Inference 1, if a can be divisible by B (A=QB), if K is a positive integer, then ka can also be divisible by B (KA=KQB)

Inference 2, if a can be divisible by C (A=HC), B can also be divisible by C (B=TC), then (A±B) can also be divisible by C

Because: Add two: a+b=hc+tc= (h+t) C same-type subtraction: a-b=hc-tc= (H-T) c

So: (A±b) can also be divisible by C

Inference 3, if a can be divisible by B (A=QB), B can also be divisible by a (B=ta), then a=b

because: A=QB b=ta a=qta qt=1 because Q, t are all positive integers, so t=q=1

So: a=b

The common factor is used to calculate the maximum number of two numbers, which is especially useful when the numerical value is large, and is very simple to apply to computer programs. The theory is as follows:

If Q and R are the quotient and remainder of M divided by N, i.e. M=nq+r, then gcd (m,n) =GCD (n,r).

The proof is this: set A=GCD (M,n), B=GCD (N,r)

Prove:

∵a is the greatest common divisor of m,n,

∴m can be divisible by a, and n can be divisible by a,

∴ by inference 1: QN can also be divisible by a,

∴ by inference 2: M-QN can also be divisible by a,

and ∵m-qn=r,

∴r can also be divisible by a, which is the number of conventions for N and R (note: not yet greatest common divisor)

∵b for N and R greatest common divisor, a for N and R for the number of conventions

∴a≤b,

Similarly

∵b is N, R's greatest common divisor,

∴n can be divisible by B, and R can be divisible by B,

∴ by inference 1: QN can also be divisible by B,

∴ by inference 2: Qn+r can also be divisible by B,

and ∵m=qn+r,

∴m can also be divisible by B, that is, B is the number of M and N conventions, (note: not greatest common divisor)

∵a is the m,n greatest common divisor, B is the number of M and N conventions,

∴b≤a,

From the above:

A≤b and B≤a were also established,

So you can get

A=b,

The certificate is completed.

Seeking greatest common divisor by the method of dividing

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.