GCD and LCM Calculator: What It Does
The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) are two fundamental concepts in number theory. They might sound complex, but they are essential for tasks like simplifying fractions or finding a common denominator. I built this calculator to give you instant answers for both, making your math homework or projects a little bit easier.
How to Use the Calculator
Simply enter two integers into the input fields, and the calculator will immediately show you their GCD and LCM.
What Is GCD and How Is It Calculated?
The GCD (also known as the Greatest Common Factor) of two integers is the largest positive integer that divides both numbers without leaving a remainder.
For example, let's find the GCD of 12 and 18.
- The factors of 12 are: 1, 2, 3, 4, 6, 12.
- The factors of 18 are: 1, 2, 3, 6, 9, 18.
The largest number they have in common is 6, so the GCD of 12 and 18 is 6. My calculator uses the efficient Euclidean algorithm to find this quickly.
What Is LCM and When Is It Used?
The LCM of two integers is the smallest positive integer that is a multiple of both numbers. It's what you're looking for when you need a common denominator for adding fractions.
For example, let's find the LCM of 12 and 18.
- Multiples of 12: 12, 24, 36, 48, ...
- Multiples of 18: 18, 36, 54, ...
The smallest number they both have as a multiple is 36, so the LCM of 12 and 18 is 36.
There is a handy formula that connects GCD and LCM, which my calculator uses: LCM(a, b) = (|a * b|) / GCD(a, b).