ES EN FR PT DE IT

Lcm Gcd Calculator

Lcm Gcd Calculator. Free online calculator with formula, examples and step-by-step guide.

The Lcm Gcd Calculator is a free online math calculator. Lcm Gcd Calculator. Free online calculator with formula, examples and step-by-step guide. Get instant results with the detailed formula and step-by-step examples.
Inputs
Result
Enter values and press Calculate

LCM GCD Calculator: Find Least Common Multiple and Greatest Common Divisor

What are LCM and GCD?

The Least Common Multiple (LCM) and Greatest Common Divisor (GCD), also called Greatest Common Factor (GCF), are two fundamental number theory concepts that reveal the multiplicative relationships between integers. These calculations form the backbone of fraction arithmetic, modular arithmetic, and countless real-world applications.

The GCD of two numbers is the largest positive integer that divides both without remainder. Take 84 and 126. The divisors of 84 are 1, 2, 3, 4, 6, 7, 12, 14, 21, 28, 42, 84. The divisors of 126 are 1, 2, 3, 6, 7, 9, 14, 18, 21, 42, 63, 126. The common divisors are 1, 2, 3, 6, 7, 14, 21, 42. The greatest is 42, so GCD(84, 126) = 42.

The LCM is the smallest positive integer divisible by both numbers. For 84 and 126, list multiples: 84, 168, 252, 336... and 126, 252, 378... The first common multiple is 252, making LCM(84, 126) = 252. Notice that 84 × 126 = 10,584 and GCD × LCM = 42 × 252 = 10,584. This product relationship always holds.

These calculations solve practical problems daily. When simplifying 84/126, divide both by GCD 42 to get 2/3. When adding 1/84 + 1/126, use LCM 252 as the common denominator. Gear designers use LCM to determine when rotating components realign. Event planners use LCM to synchronize recurring schedules. The GCD helps optimize tile sizes, fabric cuts, and packaging configurations.

How It Works: Methods for Finding LCM and GCD

Multiple algorithms compute the GCD and LCM, each with distinct advantages depending on the numbers involved.

Euclid's Algorithm for GCD: This 2,300-year-old method uses repeated division. To find GCD(84, 126):

  • Divide larger by smaller: 126 ÷ 84 = 1 remainder 42
  • Divide previous divisor by remainder: 84 ÷ 42 = 2 remainder 0
  • When remainder reaches 0, the last non-zero remainder is the GCD: 42

Prime Factorization Method: Break each number into prime factors:

  • 84 = 2 × 2 × 3 × 7 = 2² × 3 × 7
  • 126 = 2 × 3 × 3 × 7 = 2 × 3² × 7
  • GCD = product of common primes with smallest exponents = 2¹ × 3¹ × 7¹ = 42
  • LCM = product of all primes with largest exponents = 2² × 3² × 7¹ = 252

The LCM Formula: Once you have the GCD, calculate LCM using: LCM(a, b) = |a × b| / GCD(a, b). For 84 and 126: LCM = (84 × 126) / 42 = 10,584 / 42 = 252. This formula is computationally efficient since Euclid's algorithm finds GCD quickly even for very large numbers.

Why Euclid's Algorithm Works: The key insight is that GCD(a, b) = GCD(b, a mod b). When you divide a by b with remainder r, any common divisor of a and b must also divide r. Repeatedly applying this principle reduces the problem until the remainder is zero. The algorithm's efficiency makes it one of the oldest computational procedures still in use today.

Step-by-Step Guide: Computing LCM and GCD

Step 1: Identify Your Two Numbers
Write down the two positive integers you're analyzing. For this guide, we'll use 168 and 252. Clear identification prevents confusion when managing multiple calculations. If working with negative numbers, use their absolute values—GCD and LCM are always positive.

Step 2: Choose Your Primary Method
For numbers under 200, prime factorization provides insight into the number structure. For larger numbers, Euclid's algorithm is faster. With 168 and 252, we'll demonstrate Euclid's approach for speed, then verify with prime factorization for understanding.

Step 3: Apply Euclid's Algorithm
Divide 252 by 168: 252 = 168 × 1 + 84. Now divide 168 by 84: 168 = 84 × 2 + 0. The remainder is 0, so the GCD is 84. This took only two division steps. For comparison, listing all divisors of 168 (1, 2, 3, 4, 6, 7, 8, 12, 14, 21, 24, 28, 42, 56, 84, 168) and 252 would be much slower.

Step 4: Verify with Prime Factorization
Factor 168 = 2³ × 3 × 7 and 252 = 2² × 3² × 7. Common primes are 2, 3, and 7. Smallest exponents: 2², 3¹, 7¹. GCD = 4 × 3 × 7 = 84 ✓. This confirms our Euclidean result and shows why 84 is the greatest common divisor—it contains exactly the shared prime factors.

Step 5: Calculate the LCM
Use the formula: LCM = (168 × 252) / 84 = 42,336 / 84 = 504. Alternatively, from prime factors: LCM = 2³ × 3² × 7 = 8 × 9 × 7 = 504. Both methods agree. The LCM is always at least as large as the larger number and at most their product.

Step 6: Validate the Results
Check that GCD divides both numbers: 168 ÷ 84 = 2 ✓ and 252 ÷ 84 = 3 ✓. Verify LCM is divisible by both: 504 ÷ 168 = 3 ✓ and 504 ÷ 252 = 2 ✓. Confirm the product relationship: GCD × LCM = 84 × 504 = 42,336 = 168 × 252 ✓. These cross-checks catch calculation errors immediately.

Real-World Examples with Complete Calculations

Example 1: Simplifying Fractions
Reduce the fraction 168/252 to lowest terms. First find GCD(168, 252) = 84 using Euclid's algorithm. Divide numerator and denominator by 84: 168 ÷ 84 = 2 and 252 ÷ 84 = 3. The simplified fraction is 2/3. This is much faster than trial division by 2, 3, 4, 6, 7, etc. Any fraction reduces to lowest terms in one step using the GCD.

Example 2: Adding Fractions
Compute 1/168 + 1/252. Find LCM(168, 252) = 504. Convert each fraction: 1/168 = 3/504 (multiply by 3/3) and 1/252 = 2/504 (multiply by 2/2). Sum: 3/504 + 2/504 = 5/504. The LCM gives the smallest common denominator, keeping numbers manageable. Using the product 168 × 252 = 42,336 would work but create unnecessarily large intermediate values.

Example 3: Scheduling Recurring Events
Two buses depart from a station. Bus A leaves every 168 minutes; Bus B every 252 minutes. If both depart at 6:00 AM, when do they next leave together? Find LCM(168, 252) = 504 minutes = 8 hours 24 minutes. They synchronize at 2:24 PM, then again at 10:48 PM. The GCD (84 minutes) tells you the maximum frequency of synchronized departures if schedules were adjusted.

Example 4: Tiling a Rectangular Floor
A room measures 168 inches by 252 inches. You want the largest square tiles that fit perfectly without cutting. What size tiles? Find GCD(168, 252) = 84 inches. Use 84" × 84" tiles (perhaps as a design template for smaller tiles). The room requires (168÷84) × (252÷84) = 2 × 3 = 6 tiles. For practical 12" tiles: GCD(168, 252) = 84, and 84÷12 = 7, confirming 12" tiles work evenly.

Example 5: Gear Ratio Synchronization
Two meshing gears have 168 and 252 teeth. How many rotations before the same teeth meet again? Find LCM(168, 252) = 504. The first gear rotates 504÷168 = 3 times; the second rotates 504÷252 = 2 times. After 3 rotations of gear A and 2 rotations of gear B, tooth #1 on each gear re-engages. The GCD (84) represents the number of unique tooth pairings during one complete cycle.

Common Mistakes to Avoid

Mistake 1: Confusing GCD with LCM
Students frequently swap these concepts. Remember: GCD is a divisor (factor), so it cannot exceed the smaller number. LCM is a multiple, so it cannot be smaller than the larger number. If you calculate GCD(48, 72) and get 144, something's wrong—144 exceeds both inputs, so it must be the LCM. GCD(48, 72) = 24, while LCM(48, 72) = 144.

Mistake 2: Stopping Euclid's Algorithm Prematurely
The algorithm continues until the remainder equals zero. For GCD(91, 143): 143 = 91 × 1 + 52, then 91 = 52 × 1 + 39, then 52 = 39 × 1 + 13, then 39 = 13 × 3 + 0. The GCD is 13, not 52 or 39. Some students stop at the first remainder. Keep dividing until you hit zero—the last non-zero remainder is your answer.

Mistake 3: Misapplying Prime Factorization Rules
For GCD, take the smallest exponent of each common prime. For LCM, take the largest exponent of each prime present. With 72 = 2³ × 3² and 108 = 2² × 3³: GCD uses 2² × 3² = 36 (smallest exponents), LCM uses 2³ × 3³ = 216 (largest exponents). Swapping these rules produces incorrect results that fail the product check.

Mistake 4: Forgetting Absolute Values with Negatives
GCD and LCM are defined as positive integers. GCD(-48, 72) equals GCD(48, 72) = 24. The formula LCM(a, b) = |a × b| / GCD(a, b) includes absolute value deliberately. Computing LCM(-12, 18): |(-12) × 18| / 6 = 216 / 6 = 36, not -36. Negative inputs don't change the result—use absolute values from the start.

Pro Tips for Faster LCM and GCD Calculations

Tip 1: Recognize Coprime Numbers Instantly
Two numbers are coprime (relatively prime) when their GCD equals 1. Consecutive integers are always coprime: GCD(17, 18) = 1, GCD(100, 101) = 1. When you spot coprime numbers, the LCM is simply their product: LCM(17, 18) = 306. Prime numbers are coprime to any number they don't divide. This recognition eliminates calculation entirely.

Tip 2: Use the Division Ladder for Multiple Numbers
Finding GCD of three or more numbers? Write them in a row (24, 36, 60, 84). Divide all by a common prime (2): 12, 18, 30, 42. Divide by 2 again: 6, 9, 15, 21. Divide by 3: 2, 3, 5, 7. No common divisor remains. Multiply divisors used: 2 × 2 × 3 = 12. That's your GCD. This visual method prevents losing track of factors across multiple numbers.

Tip 3: Leverage the Product Relationship for Verification
The identity GCD(a, b) × LCM(a, b) = a × b is a powerful check. If you calculate GCD(56, 98) = 14 and LCM = 392, verify: 14 × 392 = 5,488 and 56 × 98 = 5,488 ✓. Mismatch indicates an error. This relationship also lets you find LCM from GCD (or vice versa) without additional factorization.

Tip 4: Apply Divisibility Rules as a Shortcut
Quick divisibility tests reveal common factors before calculating. Both 252 and 378 are even (factor of 2). Their digit sums are 9 and 18, both divisible by 9. So they share at least 2 × 9 = 18. For 252 and 378: GCD is actually 126. Pre-screening with divisibility rules narrows your search and provides sanity checks for Euclid's algorithm results.

Tip 5: Use GCD to Simplify Before LCM
When finding LCM of large numbers, always compute GCD first, then use the formula. For LCM(1,848, 2,772): direct prime factorization is tedious. Euclid's algorithm quickly gives GCD = 84. Then LCM = (1,848 × 2,772) / 84 = 5,122,656 / 84 = 60,984. This approach is faster and less error-prone than factoring large numbers.

Frequently Asked Questions

Yes. Use the associative property: GCD(a, b, c) = GCD(GCD(a, b), c). For 24, 36, and 60: GCD(24, 36) = 12, then GCD(12, 60) = 12. For LCM: LCM(24, 36) = 72, then LCM(72, 60) = 360. Process numbers pairwise, carrying forward each result. This works for any quantity of numbers, though calculations become more complex with each additional number.

When a divides b (or vice versa), the smaller number is the GCD and the larger is the LCM. For 15 and 45: since 45 ÷ 15 = 3 with no remainder, GCD(15, 45) = 15 and LCM(15, 45) = 45. Euclid's algorithm confirms this instantly: 45 = 15 × 3 + 0, so GCD is 15 in one step. This special case appears frequently in simplifying fractions.

GCD and LCM are defined for integers only. However, you can handle decimals by converting to whole numbers. To find GCD(0.6, 0.9), multiply both by 10: GCD(6, 9) = 3, then divide by 10 to get 0.3. For 0.25 and 0.75, multiply by 100: GCD(25, 75) = 25, divide by 100 to get 0.25. This works because scaling all numbers equally scales the GCD proportionally.

Prime numbers have exactly two factors: 1 and themselves. Two different primes share no common factors except 1. For GCD(17, 23): factors of 17 are 1, 17; factors of 23 are 1, 23. Their only common factor is 1, making them coprime. This is why fractions with prime numerators and denominators (like 17/23) are already in lowest terms.

Written and reviewed by the CalcToWork editorial team. Last updated: 2026-04-29.

Frequently Asked Questions

15% of 200 is 30. Calculated as 200 × 15 / 100 = 30.
Percentage change = ((final − initial) / |initial|) × 100. From 80 to 100 it is (20/80)×100 = 25%.
The Pythagorean theorem states that in a right triangle, c² = a² + b², where c is the hypotenuse and a, b are the legs.
If A corresponds to B, and we want what corresponds to C: X = (B × C) / A.