Skip to main content Accessibility help
×
Hostname: page-component-77c89778f8-m8s7h Total loading time: 0 Render date: 2024-07-23T23:15:00.493Z Has data issue: false hasContentIssue false

4 - Euclid's algorithm

Published online by Cambridge University Press:  05 June 2012

Victor Shoup
Affiliation:
New York University
Get access

Summary

In this chapter, we discuss Euclid's algorithm for computing greatest common divisors. It turns out that Euclid's algorithm has a number of very nice properties, and has applications far beyond that purpose.

The basic Euclidean algorithm

We consider the following problem: given two non-negative integers a and b, compute their greatest common divisor, gcd(a, b). We can do this using the well-known Euclidean algorithm, also called Euclid's algorithm.

The basic idea of Euclid's algorithm is the following. Without loss of generality, we may assume that ab ≥ 0. If b = 0, then there is nothing to do, since in this case, gcd(a, 0) = a. Otherwise, if b > 0, we can compute the integer quotient q ≔ └a/b┘ and remainder ra mod b, where 0 ≤ r < b. From the equation

it is easy to see that if an integer d divides both b and r, then it also divides a; likewise, if an integer d divides a and b, then it also divides r. From this observation, it follows that gcd(a, b) = gcd(b, r), and so by performing a division, we reduce the problem of computing gcd(a, b) to the “smaller” problem of computing gcd(b, r).

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2005

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Euclid's algorithm
  • Victor Shoup, New York University
  • Book: A Computational Introduction to Number Theory and Algebra
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139165464.006
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Euclid's algorithm
  • Victor Shoup, New York University
  • Book: A Computational Introduction to Number Theory and Algebra
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139165464.006
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Euclid's algorithm
  • Victor Shoup, New York University
  • Book: A Computational Introduction to Number Theory and Algebra
  • Online publication: 05 June 2012
  • Chapter DOI: https://doi.org/10.1017/CBO9781139165464.006
Available formats
×