MUHAMMAD YUSRAN BASRI MATH ICP B 2012 1211441023 SUMMARY EUCLIDEAN ALGORITHM A useful algorithm for finding the greatest comon divisor of two positive integers 𝑚 and 𝑛 is the Euclidean Algorithm. It consists of repeated application of the division algorithm: 𝑚 = 𝑛𝑞1 + 𝑟1 , 1 ≤ 𝑟1 ≤ 𝑛, 𝑛 = 𝑟1 𝑞2 + 𝑟2 , 1 ≤ 𝑟2 < 𝑟1 , ... 𝑟𝑘−2 = 𝑟𝑘−1 𝑞𝑘 + 𝑟𝑘 , 1 ≤ 𝑟𝑘 < 𝑟𝑘−1 , 𝑟𝑘−1 = 𝑟𝑘 𝑞𝑘+1 + 𝑟𝑘+1 , 𝑟𝑘+1 = 0, The last non zero remainder,𝑟𝑘 is the greatest common divisor of m and n. a. We will find GCD(90, 78) with no sigh factors. Step 1: Apply the division algorithm on 90 and 78 90 = 1 . 78 + 12 0 ≤r< 78 Step 2: Apply the division algorithm on 78 and 12 78 = 6 . 12 + 6 0 ≤r< 12 Step 3: Apply the division algorithm on 12 and 6 12 = 2 . 6 0 ≤r< 6 We can obtain that the GCD(90, 78) = 6 1. Lemma:If a = qb + r, then GCD(a, b) = GCD(b, r). Proof: Suppose GCD(a, b) = d. And GCD(b, r) = d (a) Because GCD(a, b) = d, then d|a and d| b. From here we obtain d | a and d|qb. so d|(a – qb) or d|r thus, d|b dan d|r (1) (b) Suppose c|b dan c|r. From here we obtain c|qb. So that c|(qb + r) or c|a. Since GCD(a, b) = d, then for c|a and c|b we will obtain c ≤ d. So, if c|b and c|r then c ≤ d (2) From (1) and (2) concluded that the GCD (b, r) = d = GCD (a, b) b. We can search GCD(a, b) without registering the factors. Step 1: Apply the division algorithm at a and b a = q1 . b + r1 0 ≤r1<b Step 2: Apply the division algorithm at b dan r1 b = q2 .r1 + r2 0 ≤r2<r1 Step 3: Apply the division algorithm at r1 dan r2 r1 = q3 .r2 + r3 0 ≤r3<r2 Step n+1: Apply the division algorithm at rn dan rn-1 rn-1 = q3 .rn 0 ≤rn+1<rn GCD(a, b) = GCD(b, r1) = . . . = GCD(rn-1 , rn ) = GCD(rn , 0) = rn Illustration Find GCD(1769, 2378). Then find the integers number x and y so that GCD(1769, 2378) = 1769x + 2378y Answer 29 = 551 – 9.58 = 551 – 9.(609 – 1.551) = 10.551 – 9.609 = 10.(1769 – 2.609) – 9.609 = 10.1769 – 29.609 = 10.1769 – 29.(2378 – 1.1769) = 1769(39) + 2378(–29) so, the value x = 39 and y = –29 2378 = 1 . 1769 + 609 1769 = 2 . 609 + 551 609 = 1 . 551 + 58 551 = 9 . 58 + 29 58 = 2 . 29 So, GCD (1769, 2378) = 29