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

โˆ™ 2011-09-12 15:11:25
This answer is:
User Avatar
Study guides

Algebra

20 cards

A polynomial of degree zero is a constant term

The grouping method of factoring can still be used when only some of the terms share a common factor A True B False

The sum or difference of p and q is the of the x-term in the trinomial

A number a power of a variable or a product of the two is a monomial while a polynomial is the of monomials

โžก๏ธ
See all cards
3.75
โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…โ˜†โ˜…
1220 Reviews

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
Related questions

A program to find the LCM of two numbers?

First, calculate the greatest common divisor (gcd) of both numbers. The following recursive function achieves that: int gcd (int a, int b) { if (!a || !b) return 0; if (a==b) return a; // base case if (a>b) return gcd(a-b, b); return gcd(a, b-a); } Now we can compute the lcm from the gcd: int lcm (int a, int b) { return (a / gcd(a, b)) * b; }


How do you write a program in BASIC to find the GCD and LCM of two integer numbers?

no


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 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; }


Is it possible for two numbers to have the same LCM and gcd?

Only if they're the same number. The LCM and GCF of 10 and 10 is 10.


Flow chart of LCM of two numbers?

(start) [calculate gcd] [calculate product] [divide] (stop)


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.


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

You can just use the GCD of any two of your numbers and find the GCD of it with your third number. Same for LCM. public class Lcmgcd { private static int gcd(int a, int b) { return (b == 0) ? a: gcd(b, a%b); } private static int lcm(int a, int b) { return a * b / gcd(a, b); } public static void main(String[] args) { int[] n = {12, 16, 28}; System.out.println("GCD: " + gcd(n[2], gcd(n[0], n[1])) + "\tLCM: " + lcm(n[1],lcm(n[2],n[0]))); } }


What is the LCM of 7 and 42?

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.


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.


Write a c program to find the LCM HCF of two numbers?

Hey Friends here is the program of HCF and LCM with output:Statement of C Program: Find The LCM and HCF of Two Numbers :#include #includevoid main(){int num1 , num2 , lcm , gcd , remainder , numerator , denominator ;clrscr();printf( "Enter two numbers\n");scanf(" %d%d " , &num1 , &num2 );if (num1 > num2){numerator=num1;denominator=num2;}else{numerator = num2 ;denominator = num1 ;}remainder = num1 % num2;while ( remainder != 0){numerator = denominator;denominator = remainder;remainder = numerator % denominator;}gcd = denominator;lcm = (num1 * num2 ) / gcd;printf("GCD of %d and %d =%d\n" , num1, num2, gcd);printf(" LCM of %d and %d= %d\n" , num1, num2, lcm);getch();}Output:Enter two numbers515GCD of 5 and 15 = 5LCM of 5 and 15 = 15

People also asked