๐ข GCD & LCM Calculator
Calculate GCD and LCM using the Euclidean algorithm
Related Calculators
GCD & LCM Calculator Guide
This tool uses the efficient Euclidean algorithm to calculate the Greatest Common Divisor (GCD) and Least Common Multiple (LCM) of two positive integers. Simply enter two positive integers to get both GCD and LCM values, along with a complete calculation process.
The GCD is the largest positive integer that divides all given numbers. The LCM is the smallest positive integer divisible by all given numbers. These two concepts are widely used in number theory, cryptography, fraction simplification, and other fields, and are fundamental topics in elementary mathematics.
Core Formulas and Algorithm
ใEuclidean Algorithm for GCDใ
gcd(a,b):
while b โ 0:
t = b
b = a mod b
a = t
return a
ใGCD-LCM Relationshipใ
LCM(a,b) = |a ร b| / GCD(a,b)
Important property: GCD(a,b) ร LCM(a,b) = a ร bPractical Examples
Important Notes
Application Scenarios
- - Fraction operations: Find LCM as common denominator for addition, find GCD for simplification
- - Scheduling: Find the minimum common interval for recurring events (e.g., shift rotation design)
- - Cryptography: RSA encryption relies on large number factorization and GCD computation
- - Gear design: Calculate minimum teeth for precise gear ratio transmission
- - Music theory: Calculate beat frequency ratios, interval harmony analysis
Relationship with Related Tools
The GCD/LCM calculator works closely with the fraction calculator โ fraction addition requires common denominators (using LCM), and results need simplification (using GCD). Permutation and combination calculations also frequently involve GCD, such as simplifying combination number C(n,k) results. Additionally, GCD is a fundamental tool in solving Diophantine equations, determining coprimality, and the Chinese Remainder Theorem. Mastering GCD/LCM calculation is the first step toward understanding number theory.