Two fundamental building blocks of number theory
The greatest common divisor (GCD, also called the highest common factor or HCF) and the lowest common multiple (LCM) are pair-of-numbers tools you first meet at school but keep using for life — especially when working with fractions. The GCD is the largest number that divides both inputs exactly; the LCM is the smallest number that both inputs divide into exactly.
How to use the calculator
Enter two whole numbers and the calculator returns both their GCD and their LCM. It handles large numbers instantly using an efficient method rather than listing out every factor.
How the answers are found
The GCD is calculated with Euclid's algorithm, one of the oldest algorithms still in use: repeatedly replace the larger number with the remainder of dividing the two, until the remainder is zero. For 48 and 18: 48 mod 18 = 12, then 18 mod 12 = 6, then 12 mod 6 = 0, so the GCD is 6. The LCM then follows from a neat relationship: LCM(a, b) = (a × b) ÷ GCD(a, b), which gives (48 × 18) ÷ 6 = 144.
Why they matter
The GCD is what you use to simplify a fraction to its lowest terms — divide the top and bottom by their GCD. The LCM gives you the lowest common denominator when adding or subtracting fractions with different denominators. Outside the classroom, the LCM answers scheduling puzzles like "two buses leave every 15 and 20 minutes — when do they next leave together?" (every 60 minutes).