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

Calculate the GCD and LCM of numbers instantly. Understand prime factorization and the Euclidean Algorithm with examples.

Engine Interativa
GCD (Greatest Common Divisor)
--
LCM (Least Common Multiple)
--

Calculating the GCD and LCM is a fundamental requirement in arithmetic, essential for simplifying fractions, solving logic problems, and synchronizing periodic events.

At Scalar, we use optimized algorithms to deliver exact results, making life easier for students and professionals. Simply enter the values in the fields below to process the calculation.

Fundamental Definitions

  • GCD (Greatest Common Divisor): Represents the largest integer that divides two or more numbers simultaneously without leaving a remainder. It is the basis for simplifying structures and ratios.
  • LCM (Least Common Multiple): The smallest positive integer that is a common multiple of two or more numbers. It is indispensable for adding fractions with different denominators.
How to calculate manually? (GCD, LCM, and Prime Factors)

The Prime Factorization Method

The most educational way to find these values is through simultaneous factorization. Let’s use the numbers 12 and 18 as an example:

  1. Factorization:
    • 12, 18 | 2 (divides both)
    • 6, 9 | 3 (divides both)
    • 2, 3 | 2
    • 1, 3 | 3
    • 1, 1 |

Calculating the LCM

We multiply all the prime factors found: $$2 \times 3 \times 2 \times 3 = 36$$ LCM (12, 18) = 36

Calculating the GCD

We multiply only the factors that divided all the numbers at the same time (marked in bold): $$2 \times 3 = 6$$ GCD (12, 18) = 6

The Euclidean Algorithm

For very large numbers, Scalar utilizes the Euclidean Algorithm (successive divisions), which is computationally much more efficient than factorization.

When to use each one?

  • Use GCD when the problem asks to “divide into equal parts,” “find the largest possible size,” or “maximum number of people.”
  • Use LCM when the problem involves “time,” “coincidence,” “when events will occur together again,” or the “smallest common interval.”

Scalar automates this logic, allowing you to focus on solving the problem while we take care of the arithmetic precision.