ì 2 âì The Euclidean Algorithm
ì 2 âì The Euclidean Algorithm
ì 2 âì The Euclidean Algorithm
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2 THE EUCLIDEAN ALGORITHM 9> recurGCD:=proc(n,m) option remember;> local temp1, temp2;> temp1:=min(abs(n),abs(m));> temp2:=max(abs(n),abs(m));> if temp1 = 0 then> temp2;> else> recurGCD(temp1,temp2 mod temp1);> end if;> end proc;recurGCD := proc(n, m)local temp1 , temp2 ;option remember;temp1 := min(abs(n), abs(m)) ;temp2 := max(abs(n), abs(m)) ;if temp1 = 0 then temp2 else recurGCD(temp1 , temp2 mod temp1 ) end ifend proc> recurGCD(109861564297,444307556492);333331 1.5. , maple procedure . 1.6. n , mapleprocedure .(Hint: procedure nargsi args[i] .) 1.9 x, y m, n gcd(x, y) =mx + ny . , 252 198 1818 = gcd(252, 198) = 4 · 252 + (−5) · 198 4 -5 . m n . 1.13 (Extended <strong>Euclidean</strong> <strong>Algorithm</strong>). x, y x ≥ y > 0 . r i q i 1.12 gcd(x, y) = r n , (1.1) s i , t i gcd(x, y) = s n · x + t n · y