9
The Euclidean Algorithm That’s right, it’s real.

The Euclidean Algorithm

Embed Size (px)

DESCRIPTION

The Euclidean Algorithm. That’s right, it’s real. Duh it’s real. One of the oldest known algorithms. Used to find the greatest common divisor of two positive integers. The greatest common divisor of a and b is expressed by gcd(a, b). Mini Examples. For example: gcd(12, 18) = 6 - PowerPoint PPT Presentation

Citation preview

Page 1: The Euclidean Algorithm

The Euclidean Algorithm

That’s right, it’s real.

Page 2: The Euclidean Algorithm

Duh it’s real.

• One of the oldest known algorithms. • Used to find the greatest common divisor of

two positive integers. • The greatest common divisor of a and b is

expressed by gcd(a, b).

Page 3: The Euclidean Algorithm

Mini Examples

• For example: gcd(12, 18) = 6• And: gcd(420, 66) = 6

• And: ...you get the idea…

Page 4: The Euclidean Algorithm

In a Nut Shell

Blue collar-ly, there’s a looping process going on that ends when the remainder is finally zero.

At this point, the greatest common divisor is the last divisor used.

This is the part where you do an example on the board, Harold.

Page 5: The Euclidean Algorithm

How’s it work

Take the larger of the two values that you are finding the gcd for. (I assume a>=b).

Divide a by b, getting a quotient and a remainder.

Next, divide b by the first remainder that you get, and thus a cycle has begun, and can be seen when arrows are drawn in.

Page 6: The Euclidean Algorithm

And it can get CRAZY

Page 7: The Euclidean Algorithm

Proving Euclid Wasn’t Nuts

Buckle your seatbelts. This could get rough.

Page 8: The Euclidean Algorithm

Euclidean Alg. Elsewhere

• Proving two numbers are relatively prime.• Finding modular inverses to help solve and

decrypt the RSA algorithm. (which I will NOT go over for your sanity)

• RSA is public key cryptography.

Ooooo look more examples!

Page 9: The Euclidean Algorithm

Homework

• Find the gcd(147, 105)• Find the gcd(Birthyear, Birthmonth^2)• Prove that 1193 and 317 are relatively prime.

Then, try using Fermat’s Little Theorem to find the value of x in the equation:

317x = 1 mod 1193