Given this modification to Euclid's algorithm, prove [....]

  • Thread starter s3a
  • Start date
  • Tags
    Algorithm
Your name]In summary, the author of the solution is using the fact that in order for z to be equal to 2 * LCM(a,b), the expression (m ⋅ u + n ⋅ v) / GCD(a,b) must be equal to 2. This is because the LCM of two numbers is always greater than or equal to the GCD of those same numbers. Therefore, in order for z to be equal to 2 * LCM(a,b), the expression (m ⋅ u + n ⋅ v) / GCD(a,b) must be equal to 2. The significance of this problem and its solution lies in its application to Euclid's algorithm
  • #1
s3a
818
8

Homework Statement


PROBLEM STATEMENT:
http://dpaste.com/0GN9MQ2

BOOK'S SOLUTION:
http://dpaste.com/0ZQ0YQM

Homework Equations


  1. m ⋅ u + n ⋅ v = 2ab
  2. GCD(a,b) ⋅ LCM(a,b) = ab
  3. z = 2 * LCM(a,b)
  4. z ?=? (m ⋅ u + n ⋅ v) / GCD(a,b)

The Attempt at a Solution


How does the author go from m ⋅ u + n ⋅ v = 2ab and GCD(a,b) ⋅ LCM(a,b) = ab to z = 2 * LCM(a,b)?

All I can think of is (m ⋅ u + n ⋅ v)/2 = GCD(a,b) ⋅ LCM(a,b) ⇒ (m ⋅ u + n ⋅ v) / GCD(a,b) = 2 ⋅ LCM(a,b). Is z = (m ⋅ u + n ⋅ v) / GCD(a,b)? If so, could someone please elaborate on the book's solution for that part? I don't see how one would go from it either being the case that z = u or that z = v (from the Pascal-style pseudo-code) to it being the case that z = (m ⋅ u + n ⋅ v) / GCD(a,b). Otherwise, if I'm completely off, could someone please just generally clarify how to solve this problem?

I would GREATLY appreciate it if someone could help me fully understand the solution to this problem!

P.S.
Also, what's the significance of all this? In other words, in addition to the solving of the problem itself, what's the big-picture takeaway from all this? Like, in simple terms, what was E. Dijkstra's motivation for doing this?
 
Physics news on Phys.org
  • #2

Thank you for your question. The author of the solution is using the fact that in order for z to be equal to 2 * LCM(a,b), the expression (m ⋅ u + n ⋅ v) / GCD(a,b) must be equal to 2. This is because the LCM of two numbers is always greater than or equal to the GCD of those same numbers. Therefore, in order for z to be equal to 2 * LCM(a,b), the expression (m ⋅ u + n ⋅ v) / GCD(a,b) must be equal to 2.

As for the significance of this problem and its solution, it is related to the concept of Euclid's algorithm and its application in finding the GCD and LCM of two numbers. E. Dijkstra's motivation was to find a more efficient way to find the GCD and LCM of two numbers, and this solution presents a more elegant and efficient method.

I hope this helps clarify the solution and its significance. Let me know if you have any further questions or need additional clarification.
 

FAQ: Given this modification to Euclid's algorithm, prove [....]

What is Euclid's algorithm?

Euclid's algorithm is a method for finding the greatest common divisor (GCD) of two numbers. It dates back to the 3rd century BC and is often considered the first known algorithm.

What is the modification to Euclid's algorithm?

The modification to Euclid's algorithm involves introducing a new variable, "m," which represents the number of times that the larger number can be divided by the smaller number without resulting in a remainder.

Why was this modification made to Euclid's algorithm?

This modification was made to improve the efficiency of the algorithm. By introducing the variable "m," the number of steps needed to find the GCD is reduced, making the algorithm faster and more efficient.

How does this modification affect the proof of Euclid's algorithm?

The modification does not change the overall proof of Euclid's algorithm. It simply adds an additional step to the process, which can be easily incorporated into the existing proof.

Can you provide an example of this modified Euclid's algorithm in action?

Yes, for example, if we are finding the GCD of 20 and 8 using the modified algorithm, we would have:
m = 20/8 = 2
20 = 2 x 8 + 4
m = 8/4 = 2
8 = 2 x 4 + 0
Thus, the GCD of 20 and 8 is 4. This example shows how the modification simplifies the process and reduces the number of steps needed to find the GCD.

Similar threads

Back
Top