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
A = {0, 1, 2, 3, 4}  B = {2, 3, 4, 5}Given the sets A and B, how many constants maps are there from A into B.
Show that P is closed under union
Show that property (3) of a matroid implies: For any S ∈ I, {x} ∈ I, there exists y ∈ S, such that S \ {y} ∪ {x} ∈ I.
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