Current location - Recipe Complete Network - Complete vegetarian recipes - The derivation process of euclidean division
The derivation process of euclidean division

The derivation process of euclidean division is as follows:

Suppose the two numbers are a and b (a>b), and use gcd(a,b) to represent the greatest common divisor of a and b, r=a(modb) is the remainder of a divided by b, and k is the quotient of a divided by b, that is, a÷b=k...r. Euclidean division is to prove gcd(a,b)=gcd(b,r). Step 1: c=gcd(a,b), then assume a=mc, b=nc Step 2: According to the premise, r=a-kb=mc-knc=(m-kn)c

< p>Step 3: According to the results of the second step, we know that c is also a factor of r. Step 4: It can be concluded that m-kn and n are relatively prime (assuming m-kn=xd, n=yd(d>1), then m= kn+xd=kyd+xd=(ky+x)d, then a=mc=(ky+x)cd, b=nc=ycd

Then a common divisor of a and b cd>. c, so c is not the greatest common divisor of a and b, which is contradictory to the previous conclusion), so c is also the greatest common divisor of b and r. It can be seen that gcd(b,r)=c, and then gcd(a,b)=gcd(b,r). Certification completed. The above steps are based on r≠0 at the beginning. That is, m and n are also mutually prime.

Explanation:

The euclidean algorithm, also known as the Euclidean algorithm, is an algorithm for finding the greatest common factor of two positive integers. It is the oldest known algorithm, dating back to 300 BC.

Source:

Suppose the two numbers are a and b (a>b), the steps to find the greatest common divisor (a, b) of a and b are as follows: divide a by b , we get a÷b=q...r1(0≤r1). If r1=0, then (a, b)=b; if r1≠0, then divide r1 by b, and get b÷r1=q...r2 (0≤r2). If r2=0 , then (a, b)=r1, if r2≠0.

Then continue to divide r1 by r2,...and so on until it can be divided evenly. The last divisor with a remainder of 0 is the greatest common divisor of (a, b). For example: a=25,b=15, a/b=1...10,b/10=1...5,10/5=2...0, The last divisor with a remainder of 0d is 5, and 5 is the greatest common divisor required.