Euclid's Algorithm Flashcards

Computes gcd of a and b

1
Q

Compute the gcd of 90 and 24

A

Divide previous two and keep remainder

90/24 remainder is 18
24 /18 remainder = 6
18/ 6 remainder = 0

gcd is 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Why is euclid memory efficient?

A

Only store maximum three balues at once

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Extended Euclid: output

A

gcd(a,b), u, v such that gcd(a,b) = au + bv

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Extended Euclid: Compute 90 and 24.

A

gcd(90,24) = 90u + 24v

90 = 243 + 18
24 = 18
1 + 6
18 = 6*3+0

18 = 90-243
6 = 24-18
1

6 = 24-(90-243)1
6 = -90+24*4

so u = -1 and v = 4

How well did you know this?
1
Not at all
2
3
4
5
Perfectly