answersLogoWhite

0


Best Answer

If you have the gcd or the LCM of two numbers, call them a and b, you can use the relationship that gcd(a,b) = (a multiplied by b) divided by LCM (a,b) where LCM or gcd (a,b) means the LCM or a and b. This means the gcd multiplied by the LCM is the same as the product of two numbers.

Let's assume you have neither.

There are several ways to do this. One way to approach both problems at once is to factor each number into primes. You can use these prime factorizations to find both the LCM and gcd

To compute the Greatest common divisor, list the common prime factors and raise each to the least multiplicities that occurs among the several whole numbers.

To compute the least common multiple, list all prime factors and raise each to the greatest multiplicities that occurs among the several whole numbers.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Compute the gcd and LCM of two numbers?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Smallest number that is a multiple of two numbers?

The smallest number that is a multiple of two given numbers is called the least common multiple (LCM) of those two numbers. It can be found by taking the product of the two numbers and dividing it by their greatest common divisor (GCD).


Can a least common multiple be found for any two natural numbers?

Short answer: Yes. Long answer: Explanation: lcm means least common multiple, gcd means greatest common divisor, |a| means the absolute of a, a / b means a divided by b, a * b means a multiplied by b Premise: Let a and b be a natural numbers, i.e. a ⋲ IN, b ⋲ IN. 1: It is known that lcm(a, b) = (|a| * |b|) / gcd(a, b) 2: Also the gcd of two numbers is at least 1, or in math: ∀ a ⋲ IN: gcd(a, b) >= 1. 3: From 1 and 2 we can conclude: lcm(a, b) = |a| * |b| / gcd(a, b) <= |a| * |b| 4: From 3 and the premise we can conclude (because ∀ a ⋲ IN: |a| = a): lcm(a, b) <= a * b 5: Now the product of two natural numbers (like a and b) is a natural number as well, or in math: ∀ a ⋲ IN, b ⋲ IN: a * b ⋲ IN 6: From 2 and 5 we can finally conclude, that: ∀ a ⋲ IN, b ⋲ IN ∃ c ⋲ IN: lcm(a, b) <= c


Java program for finding GCD and LCM of two given numbers?

These are the two functions you need: public static int lcm(int i1, int i2) { return (i1*i2/gcd(i1,i2)); } public static int gcd(int i1, int i2) { // using Euclid's algorithm int a=i1, b=i2, temp; while (b!=0) { temp=b; b=a%temp; a=temp; } return a; }


Find two composite numbers with a GCD of 1?

Any two numbers who are relatively prime will workSo look at 9 and 4. Neither is prime and their GCD is 1.You must need two numbers with NO other factors in common.


Can the GCF of two different numbers is the LCM of the numbers?

No, the only way the GCF and LCM of two numbers can be the same is if the numbers are the same.

Related questions

The gcd of 72 and 252 is 36 find their LCM?

If you have two numbers m and n and their gcd (or gcf), g then their LCM = m*n/g so LCM = 72*252/36 = 2*252 = 504.


What is the gcd and LCM of 750?

You need at least two numbers to find either of those.


How do you calculate LCM of three numbers by pesudo code?

For this you will need a couple of helper algorithms. The first is the GCD (greatest common divisor) which is expressed as follows:procedure GCD (a, b) isinput: natural numbers a and bwhile ab doif a>blet a be a-belselet b be b-aend ifend whilereturn aThe second algorithm is the LCM (least common multiple) of two numbers:procedure LCM (a, b) isinput: natural numbers a and b return (a*b) / GCD (a, b)Now that you can calculate the GCD and LCM of any two natural numbers, you can calculate the LCM of any three natural numbers as follows:procedure LCM3 (a, b, c) isinput: natural numbers a, b and c return LCM (LCM (a, b), c)Note that the LCM of three numbers first calculates the LCM of two of those numbers (a and b) and then calculates the LCM of that result along with the third number (c). That is, if the three numbers were 8, 9 and 21, the LCM of 8 and 9 is 72 and the LCM of 72 and 21 is 504. Thus the LCM of 8, 9 and 21 is 504.


How do you write a C program to find the GCD and LCM of two numbers using a switch statement?

The following function will return the GCD or LCM of two arguments (x and y) depending on the value of the fct argument (GCD or LCM). enum FUNC {GCD, LCM}; int gcd_or_lcm(FUNC fct, int x, int y) { int result = 0; switch (fct) { case (GCD): result = gcd (x, y); break; case (LCM): result = lcm (x, y); break; } return result; }


What is the LCM of 42 and 7?

The LCM of any two numbers can be found with the following formula:LCM(a,b) = (ab) / GCD (a,b).The GCD of two numbers is best found with the Euclidean algorithm which is as follows:GCD(a,b) =a --if b = 0or GCD(b, a mod b) otherwiseIn the example given we have GCD(42,7) = GCD(7, 0) = 7Then LCM(42,7) = (7*42)/7 = 42Note: mod is the operation of dividing one number by another and taking the remainder. e.g. 7 mod 4 = 3, 12 mod 6 = 0.


Smallest number that is a multiple of two numbers?

The smallest number that is a multiple of two given numbers is called the least common multiple (LCM) of those two numbers. It can be found by taking the product of the two numbers and dividing it by their greatest common divisor (GCD).


If the GCD of two number is 16 and product of the number is 3584 find the LCM?

If we multiply the gcd and the LCM, we get the numbers.Call the numbers a and b. So 16(LCM)=ab3584=ab let's all the LCM, x 16x=a(3584/a)using the information above.x= 1/16(3584)or x=224 So the LCM is 224 we can just say the (gcd)LCM=ab=3584, so just divide 3584 by 16.


Can a least common multiple be found for any two natural numbers?

Short answer: Yes. Long answer: Explanation: lcm means least common multiple, gcd means greatest common divisor, |a| means the absolute of a, a / b means a divided by b, a * b means a multiplied by b Premise: Let a and b be a natural numbers, i.e. a ⋲ IN, b ⋲ IN. 1: It is known that lcm(a, b) = (|a| * |b|) / gcd(a, b) 2: Also the gcd of two numbers is at least 1, or in math: ∀ a ⋲ IN: gcd(a, b) >= 1. 3: From 1 and 2 we can conclude: lcm(a, b) = |a| * |b| / gcd(a, b) <= |a| * |b| 4: From 3 and the premise we can conclude (because ∀ a ⋲ IN: |a| = a): lcm(a, b) <= a * b 5: Now the product of two natural numbers (like a and b) is a natural number as well, or in math: ∀ a ⋲ IN, b ⋲ IN: a * b ⋲ IN 6: From 2 and 5 we can finally conclude, that: ∀ a ⋲ IN, b ⋲ IN ∃ c ⋲ IN: lcm(a, b) <= c


What is the LCM of 45 and 66?

the LCM of two numbers times the greatest common divisor of those two numbers is the product of those two numbers LCM(45 and 66) * GCD(45 and 66) = 45*66 To find the GCD, factor the two numbers 45 = 9*5 = 3*3*5 = 32 * 5 66 = 6*11 = 2 * 3 * 11 The greatest common divisor is 3 since 45 isn't divisible by 2 or 11 and 55 isn't divisible by 32 or 5 but both are divisible by 3. LCM * 3 = 2970 Plugging into the above formula LCM = 2970 /3 = 990


What is the gcd of any two consecutive even numbers?

The GCD is 2.


What is Euclid's Algorithm?

Euclid's algorithm is a popular algorithm to compute the GCD of two numbers. Algorithm: Gcd(a,b) = Gcd(b, a mod b), where a>=b and Gcd(a,0) = a Say we want to find the GCD of 72 and 105. 105 mod 72 = 33, so GCD(72,105) = GCD(33,72) 72 mod 33 = 6, so GCD(33,72) = GCD(6,33) 33 mod 6 = 3 so GCD(6,33) = GCD(3,6) 6 mod 3 = 0 so GCD(3,6) = GCD(0,3) = 3. So the GCD of 72 and 105 is 3.


A program to find GCD andLCM of two numbers?

// recursive algorithm to return gcd using Euclid's Algorithm int gcd (int a, int b) { if (a<0) a= -a; if (b<0) b= -b; if (a<b) { int tmp; tmp= a; a= b; b= tmp; } if (b == 0) return a; return gcd (b, a%b); } // LCM using gcd int LCM (int a, int b) { int t; t = a*b; if (t<0) t=-t; return t / gcd (a, b); }