How the LCM is calculated
The least common multiple is the smallest positive number that every number in the list divides into evenly. For two numbers, the fastest way uses the greatest common factor (GCF):
For three or more numbers, work in pairs: LCM(a, b, c) = LCM(LCM(a, b), c). The GCF comes from the Euclidean algorithm, which stays fast even for numbers with dozens of digits. That's why this calculator can handle numbers up to 100 digits long.
Worked example: 12, 18 and 30
- Using the GCF. GCF(12, 18) = 6, so LCM(12, 18) = 12 × 18 ÷ 6 = 36. Then GCF(36, 30) = 6, so LCM(36, 30) = 36 × 30 ÷ 6 = 180.
- Prime factorization. 12 = 2² × 3, 18 = 2 × 3², 30 = 2 × 3 × 5. Take each prime with its highest power: 2² × 3² × 5 = 180.
- Listing multiples. Multiples of 30 are 30, 60, 90, 120, 150, 180. The first one that 12 and 18 also divide is 180.
Where the LCM is used
- Adding fractions. The least common denominator of 1/12 + 1/18 is LCM(12, 18) = 36. The fraction calculator does this for you.
- Things that repeat. If one bus comes every 12 minutes and another every 18, they leave together every 36 minutes.
- Buying in packs. Hot dogs come in 10s and buns in 8s; you need LCM(10, 8) = 40 of each to have none left over.
When this doesn't apply
- The LCM is defined for whole numbers. For fractions, people often want the LCM of the denominators instead.
- If the list contains 0, the LCM is 0 by convention, which is rarely useful. Leave the 0 out.
- Negative signs are ignored; the LCM is always given as a positive number.
- The prime-factor working is shown for numbers below 1019, and the listing method only when the lists are short.