Question

Write an alternative gcd algorithm based on the following observations (arrange so that a > b):...

Write an alternative gcd algorithm based on the following observations (arrange so that a > b):

a. gcd(a, b) = 2gcd(a/2, b/2) if a and b are both even.

b. gcd(a, b) = gcd(a/2, b) if a is even and b is odd.

c. gcd(a, b) = gcd(a, b/2) if a is odd and b is even.

d. gcd(a, b) = gcd((a + b)/2, (a ? b)/2) if a and b are both odd

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Assign the value of min(m,n) to t.

  • Divide m by t. If the remainder of this division is 0, go to step 3; otherwise, go to step 4.
  • Divide n by t. If the remainder of this division is 0, return the value of t as the answer and stop; otherwise, go to step 4.
  • Decrease the value of t by 1. go to step 2

a. gcd(a, b) = 2gcd(a/2, b/2) if a and b are both even

Add a comment
Know the answer?
Add Answer to:
Write an alternative gcd algorithm based on the following observations (arrange so that a > b):...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT