Is This the Correct Approach to Finding GCD and LCM for Integer Pairs?

  • Thread starter Thread starter dogma
  • Start date Start date
  • Tags Tags
    Algebra
Click For Summary

Homework Help Overview

The discussion revolves around finding the greatest common divisor (gcd) and least common multiple (lcm) for integer pairs, specifically the integers 175 and 35. Participants are exploring methods to express the gcd as a linear combination of the integers involved.

Discussion Character

  • Exploratory, Mathematical reasoning, Problem interpretation

Approaches and Questions Raised

  • The original poster attempts to calculate the gcd and lcm through prime factorization and seeks confirmation of their results. They also inquire about expressing the gcd as a linear combination. Other participants suggest using Euclid's algorithm and discuss its efficiency compared to factoring. Questions arise about extracting the linear combination from the algorithm's output.

Discussion Status

Some participants have provided guidance on using Euclid's algorithm and have confirmed the correctness of the original poster's calculations. There is an ongoing exploration of different methods to find the gcd and lcm, with multiple interpretations of the linear combination aspect being discussed.

Contextual Notes

Participants note that the gcd can be found without factoring by using the relationship between gcd and lcm, and there is mention of the computational complexity of different methods. The discussion reflects a variety of approaches and insights into the problem.

dogma
Messages
35
Reaction score
0
Hello out there!

I'm working a problem where I need to find the greatest common divisor and the least common multiple for integer pairs. I then need to express the gcd as a linear combination. I could use a sanity check to make sure I'm on the right track.

I need to find the gcd and lcm of the integer pair: 175 and 35

By visual inspection, I "see" the answers, but working it out…

The gcd: [tex](175,35) = \prod_i p_i^{min(\alpha_i,\beta_i)}[/tex]

[tex]175 = 5^1\cdot35 = 5^1\cdot5^1\cdot7^1 = 5^2\cdot7^1[/tex]

[tex]35 = 5^1\cdot7^1[/tex]

[tex](175,35) = 5^1\cdot7^1 = 35[/tex]

The lcm: [tex][175,35] = \prod_i p_i^{max(\alpha_i,\beta_i)}[/tex]

[tex][175,35] = 5^2\cdot7^1 = 175[/tex]

So now I need to express the gcd as a linear combination. Is this correct:

[tex]ax + by = d[/tex] where [tex]d = (a,b)[/tex]

[tex]175x + 35y = 35[/tex]

[tex]x = 0[/tex] and [tex]y = 1[/tex]

[tex]\therefore 175\cdot(0) + 35\cdot(1) = 35[/tex]

Hopefully I'm on the right track, although I can see there being multiple solutions for the linear combination.

Thanks in advance for your help, comments, tips, clues, commentaries... :smile:
 
Physics news on Phys.org
That all looks correct.

You might consider using Euclid's algorithm for finding the GCD - it dovetails nicely with the linear combination thing.
 
Thanks for the reply.

It looks like the Euclidean Algorith would result in a one liner:

[tex]175 = 5\cdot35 + 0[/tex]

How would you "pull" the linear combination out of that? I must be missing something simple.

Thanks again.
 
Well, the example you gave is a special case b/c the gcf is one of the factors. If you had somehting like:
[tex]<15,35>=5[/tex]

Then you'd be able to use the Euclidean algorithm to find the LCF directly.
[tex]35-2(15)=5[/tex]

or
[tex]<20,35>=5[/tex]
[tex](35-20)=15[/tex]
[tex]20 - (35 - 20) = 5[/tex]
readily leads to the the linear combination
[tex]2 \times 20 - 1 \times 35 = 5[/tex]

I guess, that mostly, I like Euclid's algorithm because it's less computationally complex - it takes roughly [tex]\log(n)[/tex] time while factoring can take [tex]n^{\frac{1}{4}}[/tex] or so time. I suppose it doesn't much matter unless you're dealing with big numbers.
 
Thanks!

After reading your replies and vary info on the web (and in texts), it's very clear now.

Thanks much!
 
Hi, I thought I'd point out that you can find the lcm without factoring also. You have the relation gcd(a,b)*lcm(a,b)=a*b, for any positive integers a, b. So you can use the euclidean algorithm to find the gcd, then the lcm follows with little effort.

Also, when the euclidean algorithm spat out 175=(5)35+0, you knew the gcd was 35, since it divides both numbers. The obvious linear combination is the one you ended with, taking the coefficient of 35 to be 1. If you wanted more, you could rearrange the equation to get:

175=(4)35+35

or

(1)175-(4)35=35

Get as many different ones as you like by adding any integer multiple of (1)175-(5)35 to the left hand side.
 
Last edited:

Similar threads

  • · Replies 59 ·
2
Replies
59
Views
15K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
1
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
18
Views
4K
  • · Replies 3 ·
Replies
3
Views
10K
Replies
7
Views
3K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
2
Views
3K
Replies
26
Views
4K