number theory calculators

LCM Calculator

Find the smallest positive integer divisible by both of two given numbers. Useful for adding fractions, scheduling repeating events, and aligning cycles.

About this calculator

The Least Common Multiple (LCM) of two integers a and b is the smallest positive integer that is divisible by both. The standard formula links LCM directly to the GCD: LCM(a, b) = |a × b| / GCD(a, b). This relationship means you only need to compute the GCD (via the fast Euclidean algorithm) and then divide the product of the two numbers by it. For example, LCM(12, 18) = (12 × 18) / GCD(12, 18) = 216 / 6 = 36. The LCM is always at least as large as the larger of the two inputs. When the two numbers are coprime (GCD = 1), the LCM equals their product. LCM is widely used when finding a common denominator for fractions and when determining when two periodic events will coincide.

How to use

Suppose you need to add the fractions 5/12 and 7/18 and want the least common denominator. Enter 12 as the First Number and 18 as the Second Number. The calculator first finds GCD(12, 18) = 6, then computes LCM = (12 × 18) / 6 = 216 / 6 = 36. The least common denominator is 36. Convert: 5/12 = 15/36 and 7/18 = 14/36, so the sum is 29/36. The same tool works for scheduling — e.g., two buses departing every 12 and 18 minutes will next depart together in 36 minutes.

Frequently asked questions

How does LCM help when adding or subtracting fractions?

To add or subtract fractions with different denominators, you need a common denominator — and the LCM of the two denominators is the smallest one available, keeping numbers manageable. Multiply each fraction's numerator by whatever factor brings its denominator up to the LCM, then perform the addition or subtraction. Using the LCM rather than simply multiplying the denominators together avoids working with unnecessarily large numbers and simplifies the final answer automatically.

What is the relationship between LCM and GCD?

For any two positive integers a and b, the product of their LCM and GCD always equals the product of the numbers themselves: LCM(a, b) × GCD(a, b) = a × b. This elegant identity means you only ever need to compute one of them to derive the other. It also explains why the LCM equals the product a × b when the two numbers share no common factors (GCD = 1), and why LCM equals the larger number when one number divides the other.

When do two repeating events next occur at the same time using LCM?

If event A repeats every a units of time and event B repeats every b units, they will next coincide at time LCM(a, b). For example, if a traffic light cycles every 40 seconds and another every 60 seconds, they will next be in sync after LCM(40, 60) = 120 seconds. This principle applies to gear rotations, musical rhythm patterns, bus timetables, and any system with two or more periodic cycles that must be aligned.