120 likes | 236 Vues
This document explores the advanced techniques for computing the greatest common divisor (GCD) using Lehmer's algorithm, highlighting five specific stopping conditions proposed by Lehmer and further elaborated by Collins, Jebelean, and others. We delve into the mathematical examples demonstrating the application of these stopping conditions, presenting computational examples with detailed calculations using pairs of integers. It aims to enhance understanding of GCD algorithms in computer science and mathematics by providing a clear outline and analysis of the reasoning behind each stopping condition.
E N D
Lehmer GCD五個停止條件 張圻毓
Outline Lehmer[1938] Collins[1980] Jebelean[1993] Vallee[2004] Wang[2003]
Lehmer[1938] q= q’= If q ≠ q’ stop
Example U = 768,454,923 V = 542,167,814 b = 103 New U = 89,593,596 V = 47,099,917
Collins[1980] & Jebelean[1993] vi < |bi+1| or ui - vi < |bi+1 - bi| If i 為奇數:vi < - bi+1 or ui – vi < ai+1 - ai If i 為偶數:vi < - ai+1 or ui – vi < bi+1 - bi
Example U = 768,454,923 V = 542,167,814 q1= 768/542 = 1 (a0,b0) = (1,0) (a1,b1) = (0,1) (a2,b2) = (1,0) – (0,1) = (1,-1) New (u,v) = (542 , 226) 判斷odd vi < - bi+1 or ui – vi < ai+1 – ai 不合 q2= 542/226 = 2 (a3,b3) = (0,1) – 2(1,-1) = (-2,3) New (u,v) = (226 , 90) 判斷even vi < - ai+1 or ui – vi < bi+1 – bi 不合
Example q3= 226/90= 2 (a4,b4) = (1,-1) – 2(-2,3) = (5,-7) New (u,v) = (90 , 46) 判斷odd vi < - bi+1 or ui – vi < ai+1 – ai 不合 q4= 90/46 = 1 (a5,b5) = (-2,3) – 1(5,-7) = (-7,10) New (u,v) = (46 , 44) 判斷even vi < - ai+1 or ui – vi < bi+1 – bi合
Vallee[2004] If aj > then Qi=qi for all i ≦ j-2 Example: u = 768 v = 542 (a0,b0) = (1,0) (a1,b1) = (0,1) While 542 > √768(≒27) do q1 = u div v = 1 new u = u mod v = 226 a2 = -a1q1+a0 = 1 b2 = -b1q1+b0 = -1 i+1=2
Example u = 542 v = 226 While 226 > √768 do q2 = u div v = 2 new u = 90 a3 = -2 b3 = 3 u = 226 v = 90 While 90 > √768 do q3 = u div v = 2 new u = 46 a4 = 5 b4 = -7
Example u = 90 v = 46 While 46 > √768 do q4 = u div v = 1 new u = 44 a5 = -7 b5 = 10 u = 46 v = 44 While 44 > √768 do q5 = u div v = 1 new u = 2 a6 = 12 b6 = -17 while 2 < √768 stop
Wang[2003] New ui+2 ≧ |qi+1| or New Ui+2 ≧ λ|Qi+1| New u ≧2|qi+2|*|qi+1| or m ≧2λ|Qi+2|*|Qi+1|