Mathematical Tools

Active tool: GCD / LCM & Prime Factors

Selected option: Results update automatically

What It Does

Finds the greatest common divisor (GCD) and least common multiple (LCM) of a set of whole numbers, and gives each number’s prime factorization — showing the Euclidean-algorithm and trial-division steps. Everything runs in your browser.

How to Use It

  1. Enter your whole numbers, separated by commas, spaces, or newlines.
  2. Read the GCD, LCM, and each number’s prime factorization.
  3. Toggle Steps to see the working; Copy or export the results.

Options Explained

OptionDescription
NumbersThe whole numbers to analyze (up to 50).
StepsShow the Euclidean-algorithm and trial-division working.
Factor limitLargest prime factor shown individually; factors above this may be combined into a leftover.
💡 Tip: The GCD is the product of the primes common to every number (each to its smallest power), while the LCM takes each prime to its largest power across the set.
Numbers

Separate whole numbers with commas, spaces, tabs, or newlines.

Enter one or more whole numbers to see the GCD, LCM, and prime factors.

About GCD, LCM & the Fundamental Theorem of Arithmetic

Every whole number bigger than 1 can be written as a product of prime numbers in exactly one way (ignoring order) — this is the fundamental theorem of arithmetic, and it’s the key to both the GCD and the LCM. The greatest common divisor of a set is the largest number that divides all of them; in prime terms it’s the product of the primes they share, each raised to the smallest power that appears. The least common multiple is the smallest number they all divide into; it’s the product of every prime that appears in any of them, each raised to the largest power.

The two are linked by a tidy identity — for a pair, GCD × LCM = a × b — which is why this tool can find the LCM straight from the GCD. The fastest way to get the GCD is the Euclidean algorithm, over two thousand years old: repeatedly replace the larger number by the remainder when it’s divided by the smaller, and the last non-zero value is the GCD (that’s why gcd(12,18) becomes gcd(18,12) → gcd(12,6) → gcd(6,0) = 6). Because this tool uses arbitrary-precision integers, it stays exact even for enormous numbers, and it runs entirely on your device.