📐

GCD and LCM Calculator

Math Free Instant Private
Math

### Number Theory & The Euclidean Algorithm The **Greatest Common Divisor (GCD)** is the largest positive integer that divides all numbers without a remainder, while the **Least Common Multiple.

Reviewed by Miss Saima · MA Mathematics
Last updated:
Editorial Guidelines

⚙ Input Values

📊 Results

Greatest Common Divisor (GCD / GCF)
24
Least Common Multiple (LCM)
144
✦ Prime Factorizations
48 = 2^4 × 3 | 72 = 2^3 × 3^2
Euclidean Algorithm Steps
-- GCD of 48 and 72 -- → 48 = (72 × 0) + 48 → 72 = (48 × 1) + 24 → 48 = (24 × 2) + 0
Product Identity: GCD × LCM = A × B
24 × 144 = 3456 (Matches 48 × 72 = 3456 ✓)
✦ Number Theory Diagnostic Summary
Number Theory GCD & LCM Profile (48 & 72): Greatest Common Divisor GCD(48, 72) = 24. Least Common Multiple LCM(48, 72) = 144. Prime Factorization: 48 = 2^4 × 3 | 72 = 2^3 × 3^2. Euclidean Identity: 24 × 144 = 3456 (Matches 48 × 72 = 3456 ✓). Number Theory Standard: By the Fundamental Theorem of Arithmetic, $\gcd(a, b) = \prod p_i^{\min(a_i, b_i)}$ and $\text{lcm}(a, b) = \prod p_i^{\max(a_i, b_i)}$, yielding the universal duality $\gcd(a, b) \times \text{lcm}(a, b) = |a \times b|$.
Embed on Your Website

Copy and paste this code into your website.

<iframe src="https://calcusolve.com/calculator/gcd-and-lcm-calculator?embed=true" width="100%" height="600" frameborder="0" loading="lazy" title="GCD and LCM Calculator"></iframe>

📐 Formula

Formula Reference: GCD and LCM Calculator
Input variables:
numbersInputString — Enter Numbers (Comma or Space-Separated, e.g. 48, 72, 120)
Computed outputs:
greatestCommonDivisorGcd — Greatest Common Divisor (GCD / GCF)
leastCommonMultipleLcm — Least Common Multiple (LCM)
primeFactorizationsSummary — Prime Factorizations
euclideanAlgorithmStepsTrace — Euclidean Algorithm Steps
productIdentityVerification — Product Identity: GCD × LCM = A × B
Mathematical relationships extracted from calculation logic:
n = Math.floor(n / d)
d = d === 2 ? 3 : d + 2
q = Math.floor(a / b)
prod = nums[0] * nums[1]
gcdLcmProd = overallGcd * overallLcm
Standard: NIST / ISO mathematical definitions

💡 Practical Example

✅

For three numbers 12, 18, and 30, computing prime factorizations gives $\gcd=2^1 \cdot 3^1=6$ and $\text{lcm}=2^2 \cdot 3^2 \cdot 5=180$.

📖 About GCD and LCM Calculator

Number Theory & The Euclidean Algorithm

The Greatest Common Divisor (GCD) is the largest positive integer that divides all numbers without a remainder, while the Least Common Multiple (LCM) is the smallest positive integer divisible by all numbers:

  • **
  • Euclidean Division Algorithm for GCD**:

(a, b) = (b, a ±od b) with (a, 0) = a

  • **
  • The Fundamental GCD-LCM Duality Identity**:

(a, b) × lcm(a, b) = |a × b| lcm(a, b) = (|a × b|) / ((a, b))

  • **
  • Prime Factorization Method**:

For any numbers a = Π p_i^α_i and b = Π p_i^β_i:

(a, b) = Π p_i^(α_i, β_i)

lcm(a, b) = Π p_i^(α_i, β_i)

How to Use This Calculator

Enter your Enter Numbers (Comma or Space-Separated, e.g. 48, 72, 120) (e.g. 48, 72) and Number Theory Benchmark — choose from Custom Numbers, 48 & 72 (GCD: 24 / LCM: 144), 12, 18, 30 (GCD: 6 / LCM: 180). Results update instantly as you type — adjust any value to compare scenarios.

The Formula

Formula Reference: GCD and LCM Calculator

Input variables:

numbersInputString — Enter Numbers (Comma or Space-Separated, e.g. 48, 72, 120)

Computed outputs:

greatestCommonDivisorGcd — Greatest Common Divisor (GCD / GCF)

leastCommonMultipleLcm — Least Common Multiple (LCM)

primeFactorizationsSummary — Prime Factorizations

euclideanAlgorithmStepsTrace — Euclidean Algorithm Steps

productIdentityVerification — Product Identity: GCD × LCM = A × B

Mathematical relationships extracted from calculation logic:

n = Math.floor(n / d)

d = d === 2 ? 3 : d + 2

q = Math.floor(a / b)

prod = nums[0] * nums[1]

gcdLcmProd = overallGcd * overallLcm

Standard: NIST / ISO mathematical definitions

Worked Example

For three numbers 12, 18, and 30, computing prime factorizations gives =2^1 · 3^1=6 and lcm=2^2 · 3^2 · 5=

180.

Understanding Your Result

Unit conversion precision: round to the same number of significant figures as your original measurement. Converting 6 feet to meters gives 1.8288 m — but if your measurement was approximate (±1 inch), expressing more than 2 decimal places is false precision. For international trade and technical specifications, SI units (meters, kilograms, liters) are the standard. US customary units (feet, pounds, gallons) differ from Imperial UK units: 1 US gallon = 3.785 L vs. 1 UK gallon = 4.546 L.

💡 Mathematical Rigor & Applied Context

  • This calculator applies exact mathematical definitions following conventions established by NIST and international standards bodies.
  • Rounding errors accumulate across multi-step calculations. For precision-critical work, maintain extra significant figures through all intermediate steps.
  • Many mathematical concepts have multiple valid formulations — if a result seems unexpected, verify which convention or definition applies to your context.
  • Dimensional analysis (unit tracking) is the fastest way to catch formula errors. Every term in an equation must have consistent, compatible units.
  • Numerical methods used in digital calculators introduce floating-point precision limits (~15 significant digits for IEEE 754 double precision).
  • For statistical and probabilistic calculations, always specify whether you are working with population parameters or sample statistics — formulas differ.
  • Visualizing a problem geometrically or testing with known boundary values (zero, infinity, negative) reveals hidden errors faster than algebraic checking.
  • When in doubt, validate your result against a simplified hand calculation or a published worked example from a textbook or standards document.

Results are for informational and educational purposes only. Always verify critical decisions with a qualified professional.

❓ Frequently Asked Questions

What is the Euclidean algorithm for GCD?

The Euclidean algorithm repeatedly divides the larger number by the smaller number and replaces the pair with the divisor and remainder until the remainder is zero; the last non-zero remainder is the GCD.

What does it mean if two numbers are coprime?

Two numbers are coprime (or relatively prime) if their greatest common divisor is 1 (gcd(a, b) = 1), meaning they share no common prime factors.

Can you calculate GCD and LCM for more than two numbers?

Yes. Apply the associative property: gcd(a, b, c) = gcd(gcd(a, b), c) and lcm(a, b, c) = lcm(lcm(a, b), c).

Why does GCD × LCM = A × B only hold for two numbers?

For two numbers, min(a,b) + max(a,b) = a + b for every prime exponent. For three or more numbers, prime overlaps occur, so gcd(a,b,c) × lcm(a,b,c) does not generally equal a × b × c.

What is the difference between GCF and GCD?

GCF (Greatest Common Factor) and GCD (Greatest Common Divisor) are completely identical mathematical terms used interchangeably.

Try Other Calculators