Ev clidean
Given tO stricty positive intege a eb such
4hat
then
gedl,)jpositive integer that
S
defned the greatst
divides
both a G.
i.e, ga
max
:eNEgezte
Agor
Aqer hm Given lsy Euclid Alex andia.
to Compute gd a,b).’
a<ls) exhange a and
2) let " be the remainder ofer dioiding a
(sy G. 4 =0, vetun ls. Else step 3
3)a o exchange a wtth
Cnd contnue de 2.
Correness
Proo
’ Proof f terminatien in inite number o
Gteps.
Since az > 20
(onsider the Set
R= ,3; denly reR
, a, 3,
Because f the coel crd ering pinple
this set hot a let lement.
thos
Al s E R Al6e since evey r;0
. i s is
6eqyence tht
a mono
tonicoly decreaaing
is Gauned belss,
94 uojll
coneg
+his tex
ey minaes the algeithm
in a inite Stefs
lets aSUme the sequence Gteps to be
to oueist that
a
Coe Can
ince
(on tinoin op the Set
epatiers, we Can
But cuhy is on 4he greatest al
act that divide (ootth
Assume dzn
then coching QUr usy em top to botemj
woy king our way to 4he
lost eaNa tien ()
See
Bt d. can nly divide on in
And oince e den (dividesr)
shuwe d=rn
4hus the Gyeatest cenmen diisor
and
Time Cemplexiy e sppey bound dor steps
needed to comFste GCD.
Notce
Caluways)
3 CosS
b=a/
ther
-lo <-a
V2
Snce
i b<od2, Since
>
os ay =22 (maximum qpotiet)
eveg
Notce thes det
Tecuring stef
Evclidean
7ogCa
n2loqa)
n<
664
loae
d 1 ence
numberr is au
slvery
aotient seq
1
O301
Ologm)(Asgmptotic
the
oound isonnaci
34,
tines coewhen
opbexaosolte
oost 3,
n2 7 the teading
time,
every
to
an
n be in 3,
ain
digts
otmost impe S,
2 ould haffens
3,
a? yesolutien,
is Té Hlaovith ,
oe
n
elanThe 4his ),
(8==4) ecutive
nosis
cons
Soy
fpoxietely
he
ecurence fhonace
evesy
Snce
aferd
ing
dd
a
Liae
ot
ime
we
can
(Gdden
Rusto) 4hus
|-418-
lbeca
Jegu()
2 099.-.
4785loge)
< 5 Loqel
:lmprouing 4he bound, onsay
leses han 3fimes Hhe