Introduction to Algorithms
Introduction to Algorithms
3rd Edition
ISBN: 9780262033848
Author: Thomas H. Cormen, Ronald L. Rivest, Charles E. Leiserson, Clifford Stein
Publisher: MIT Press
bartleby

Concept explainers

Question
Book Icon
Chapter 31.1, Problem 10E
Program Plan Intro

To prove that for all the integers a,bandc,

  gcd(a,gcd(b,c))=gcd(gcd(a,b),c) and hence to show that the gcd operator is associative.

Expert Solution & Answer
Check Mark

Explanation of Solution

Assume

  d=gcd(a,b,c),a=dp,b=dpandc=dr.

Claim gcd(a,gcd(b,c))=d

Let e=gcd(b,c)

  b=es,c=et

Since d|bandd|c,thusd|e.

Let e=dm, thus

  b=(dm)s=sq,c=(dm)t=dr.

Assume k=gcd(p,m),

  k|p,k|m,dk|dp,dk|dm,dk|dp,dk|(dm)s,dk|(dm)t,dk|a,dk|b,dk|c.

Since d=gcd(a,b,c),thusk=1.

  gcd(a,gcd(b,c))=gcd(a,e)=gcd(dp,dm)=d*gcd(p,m)=d*k=d

Hence,

  gcd(a,gcd(b,c))=d=gcd(gcd(a,b),c).

Want to see more full solutions like this?

Subscribe now to access step-by-step solutions to millions of textbook problems written by subject matter experts!
Students have asked these similar questions
"Do not use AI tools. Solve the problem by hand on paper only and upload a photo of your handwritten solution."
| √ (r² + r + 1)e^ dr
Ensure you answer the question asked at the end of the document. Do not just paste things without the GNS3 console outputs
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
LINUX+ AND LPIC-1 GDE.TO LINUX CERTIF.
Computer Science
ISBN:9781337569798
Author:ECKERT
Publisher:CENGAGE L