LCM of a List Calculator

Enter your positive integers separated by commas or spaces.

Result

180
6
3

How it is calculated

The text is split on commas and spaces. Only tokens made purely of digits and greater than zero are kept; anything else (negative numbers, decimals like 2.5, zero, letters) is skipped without a warning, and at least two valid numbers are required. The tool folds the list from left to right: lcm = lcm / gcd(lcm, x) × x for each next number x, where the gcd comes from the Euclidean algorithm (repeated remainders). The list's greatest common divisor is folded the same way, g = gcd(g, x).

It shows the LCM, the GCD and the count of numbers it actually used, so compare that count with what you typed. The arithmetic is exact whole-number arithmetic; if the LCM, or any single number, would exceed about 9.2 × 1018 (the 64-bit limit), there is no result rather than a rounded one.

Worked example

List: 12, 18, 30. Start with lcm = 12 and g = 12. Add 18: gcd(12, 18) = 6, so lcm = 12 / 6 × 18 = 36 and g = 6. Add 30: gcd(36, 30) = 6, so lcm = 36 / 6 × 30 = 180 and g = gcd(6, 30) = 6. Three numbers were used. Check: 180 / 12 = 15, 180 / 18 = 10 and 180 / 30 = 6, all whole.

Try this example →

Common mistakes

  • Entering a negative number or a decimal and assuming it was used. The tool skips it silently: 12, -18, 2.5, 30 gives the LCM of 12 and 30 only (60, count 2), so check that the reported count matches what you typed.
  • Typing a zero in the list, which is ignored rather than making the LCM zero.
  • Writing numbers with thousands separators such as 1,200; the comma splits it into 1 and 200.
  • Confusing the LCM with the GCD or with the product: for 12, 18 and 30 the product is 6480 but the LCM is only 180.
  • Assuming the LCM of numbers with no common factor is small; then it equals the product and grows very fast, and several large numbers quickly exceed the limit and show no result.

About this calculator

The least common multiple (LCM) of a list of numbers is the smallest positive integer that all of them divide into evenly. This calculator extends the familiar two-number LCM to an entire list at once, computing it pairwise using the identity LCM(a,b) = a·b / GCD(a,b) and folding the result across every number you enter, while also reporting the list's overall greatest common divisor (GCD).

Finding the LCM of more than two numbers comes up whenever you need a common denominator for adding several fractions at once, or when scheduling recurring events that repeat on different cycles — for example, figuring out when three machines running on different maintenance intervals will all need servicing on the same day. It's a staple of middle- and high-school number theory as well as practical scheduling and manufacturing problems.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    The preset list shows a typical use: three things that repeat every 4, 6 and 8 minutes line up again after 24 minutes, and the same 24 is the least common denominator if you want to add fractions with those denominators. The GCD line beside it is the largest step that divides every number in the list. What do you use LCMs for, fractions, schedules, gear teeth or something else?

Popular calculators

All Calculators