By Debmedia Technologies LLP · Kolkata, India · Updated
What Is It and When Do You Need It?
The GCD is the biggest number that divides all of your numbers, and the LCM is the smallest number that all of them divide into. You need the GCD to simplify fractions and the LCM to add fractions or to find when repeating events line up.
Enter two or more whole numbers and the tool returns both, plus the prime factors of each number so you can check the result by hand.
How to Use This Tool
- Type two or more whole numbers separated by commas, spaces or lines.
- Press Calculate.
- Read the GCD and LCM at the top.
- Look at the prime factors to see why the answers are what they are.
How the Calculation Works
The GCD uses the Euclidean algorithm: replace the pair (a, b) with (b, a mod b) until the second number is zero, and the first number is the GCD. For a list, the tool applies this one number at a time.
The LCM of two numbers is a × b ÷ GCD(a, b). For a list, it takes the LCM of the running result and the next number, using exact big-integer arithmetic.
Worked Example
For 12, 18 and 30: 12 = 2² × 3, 18 = 2 × 3² and 30 = 2 × 3 × 5. The GCD takes the lowest power of each shared prime, which is 2 × 3 = 6. The LCM takes the highest power of every prime, which is 2² × 3² × 5 = 180.
Common Uses
- Reducing a fraction to lowest terms.
- Finding a common denominator.
- Scheduling: buses every 12 and 18 minutes meet again after 36 minutes.
- Dividing items into equal groups with nothing left over.
Tips and Common Mistakes
- Only whole numbers are accepted. Zero is ignored for the LCM.
- If the GCD is 1, the numbers are called coprime.
- The GCD of any number and 1 is always 1.
Related Tools
Next, you may need the fraction calculator, prime number checker, ratio calculator, permutation and combination calculator.
Everything runs in your browser. Nothing you type is uploaded, stored or sent to any outside service.
Frequently Asked Questions
Disclaimer: results are calculated in your browser from the numbers you enter. Check important results before you rely on them for money, health, safety or legal decisions.