Enter 2 or more numbers separated by commas (,). You can find the LCM of 3 or more numbers at once, and the steps with prime factorization and the greatest common factor (GCF) are shown too.
Table of Contents
-
What you can do on this page
-
What is this calculation used for?
-
How to Use
-
Formula
-
Symbols and terms
-
Good to know before you start
-
How to calculate it in Excel
-
How to calculate it in Google Sheets
-
How to calculate it in Python
-
How to write it in LaTeX and other math languages (copy and paste)
-
How to have ChatGPT do the calculation
-
DataChef Features
-
Related Features
-
NumberChef Calculators List
What you can do on this page
- Enter 2 or more numbers separated by commas (,) and get the least common multiple (LCM) on the spot
- Not only "What is the LCM of 4 and 6?" but also 3 or more numbers at once, such as "What is the LCM of 12, 18 and 30?"
- The steps show the prime factorization of each number, so you see why the answer is what it is, not just the answer
- The greatest common factor (GCF) is shown at the same time for reference
- A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
What is this calculation used for?
To calculate \(\dfrac{1}{4} + \dfrac{1}{6}\), the denominators 4 and 6 have to be made the same. The least common denominator is the LCM, \(\mathrm{lcm}(4,6) = 12\), so the sum is \(\dfrac{3}{12} + \dfrac{2}{12} = \dfrac{5}{12}\).
Multiplying the denominators to get 24 also works, but the LCM keeps the numbers small and makes simplifying easier at the end. From elementary school math to everyday work, this is where the LCM is used most.
Two bus routes leave the same stop together, one every 12 minutes and one every 18 minutes. They next leave together after \(\mathrm{lcm}(12,18) = 36\) minutes.
The moment when two things that repeat on different cycles line up is given by the LCM. It is a classic word problem in school math, and a practical tool for thinking about timetables and other schedules.
Hot dogs come in packs of 10 and buns in packs of 8. To have exactly the same number of each, the fewest you can buy is \(\mathrm{lcm}(10,8) = 40\) of each, which is 4 packs of hot dogs and 5 packs of buns.
Matching things that come in different pack sizes happens everywhere, from shopping for a cookout to ordering parts for a factory.
A gear with 12 teeth turns with a gear with 18 teeth. The two teeth that touched at the start meet again after \(\mathrm{lcm}(12,18) = 36\) teeth have passed (3 turns of the small gear and 2 turns of the large one).
In machine design, the tooth counts are often chosen to be relatively prime to make the LCM large, so the same pairs of teeth do not keep hitting each other and wear unevenly.
In the eastern US, some broods of periodical cicadas come out of the ground every 13 years and others every 17 years. A 13-year brood and a 17-year brood that come out in the same year will next do so after \(\mathrm{lcm}(13,17) = 221\) years. This happened in 2024, for the first time since 1803.
Because 13 and 17 are both prime, their LCM is simply \(13 \times 17\). How long it takes for things with different cycles to line up again is exactly what the LCM tells you.
Formula
Symbols and terms
Symbols
| \(\mathrm{lcm}(a,b)\) | L C M of a and b | The least common multiple of \(a\) and \(b\). It comes from the first letters of "least common multiple" and is also written in capitals, LCM. |
| \(\gcd(a,b)\) | G C D of a and b | The greatest common factor of \(a\) and \(b\). The symbol comes from "greatest common divisor", another name for the same number. US schools usually call it the GCF (greatest common factor). |
| \(2^2\) | two squared | A power: the small raised number (the exponent) tells how many times the same number is multiplied. \(2^2 = 2 \times 2 = 4\) and \(3^2 = 3 \times 3 = 9\). |
| \(p_1, p_2, \ldots, p_k\) | p sub 1, p sub 2 | The primes that appear in the prime factorizations, from smallest to largest. The small lowered number (the subscript) tells which prime it is in the list. |
| \(a_1, a_2, \ldots, a_k\) | a sub 1, a sub 2 | For each prime, the largest exponent (number of times it is multiplied) that appears in any of the prime factorizations. |
| \(m\) | m | The LCM of the first two numbers, found along the way. It is used when finding the LCM of 3 or more numbers two at a time. |
Terms
| multiple | A number times 1, 2, 3 and so on. The multiples of 6 are 6, 12, 18, 24, … |
| common multiple | A multiple shared by two or more numbers. The common multiples of 4 and 6 are 12, 24, 36, … and they go on forever. |
| least common multiple (LCM) | The smallest of the common multiples. This is the value this page finds. |
| factor | A whole number that divides a number evenly. The factors of 12 are 1, 2, 3, 4, 6 and 12. |
| greatest common factor (GCF) | The largest factor shared by two or more numbers. It is also called the greatest common divisor (GCD). It often goes hand in hand with the LCM, so this page shows it for reference. |
| prime number | A whole number of 2 or more whose only factors are 1 and itself (2, 3, 5, 7, 11, …). 1 is not a prime number. |
| prime factorization | Writing a whole number as a product of prime numbers only. Example - \(12 = 2 \times 2 \times 3 = 2^2 \times 3\). |
| relatively prime | When the GCF of two numbers is 1 (they have no prime factor in common). The LCM of two relatively prime numbers is just their product. |
| least common denominator (LCD) | The least common multiple of the denominators. To add or subtract fractions with different denominators, you rewrite them with the same denominator, and the LCD is the simplest one to use. This is where the LCM is used most often. |
Good to know before you start
Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.
| Multiplication facts and division (Grade 3) |
|
| Multiples and factors (Grades 4–6) |
|
| Common denominators (Grade 5) |
|
| Prime numbers and prime factorization (Grades 4–6) |
|
| Exponents (Grade 6) |
|
How to calculate it in Excel
| First number a | 4 |
| Second number b | 6 |
| LCM lcm(a, b) | =B1*B2/GCD(B1,B2) |
| First number | 12 |
| Second number | 18 |
| Third number | 30 |
| LCM | =LCM(B1,B2,B3) |
| First number | 12 |
| Second number | 18 |
| Third number | 30 |
| First, LCM of the first two, m | =LCM(B1,B2) |
| LCM of all three | =LCM(B4,B3) |
"GCD" finds the greatest common factor and "LCM" finds the least common multiple in Excel. The LCM function does the prime factorization of formula 2 for you.
The first table shows 12 in B3, and the second table shows 180 in B4. Just replace the numbers with your own (the LCM function takes more numbers, such as "=LCM(B1,B2,B3,B4)").
How to calculate it in Google Sheets
| First number a | 4 |
| Second number b | 6 |
| LCM lcm(a, b) | =B1*B2/GCD(B1,B2) |
| First number | 12 |
| Second number | 18 |
| Third number | 30 |
| LCM | =LCM(B1,B2,B3) |
| First number | 12 |
| Second number | 18 |
| Third number | 30 |
| First, LCM of the first two, m | =LCM(B1,B2) |
| LCM of all three | =LCM(B4,B3) |
How to calculate it in Python
import math
numbers = [330, 75, 450, 225] # numbers to find the LCM of (2 or more)
least_common_multiple = math.lcm(*numbers)
greatest_common_divisor = math.gcd(*numbers)
print(f"Least common multiple (LCM): {least_common_multiple}")
print(f"(For reference) greatest common factor (GCF): {greatest_common_divisor}")
How to write it in LaTeX and other math languages (copy and paste)
lcm(a, b) = a × b ÷ gcd(a, b)
\mathrm{lcm}(a, b) = \dfrac{a \times b}{\gcd(a, b)}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>lcm</mi><mo>⁡</mo>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo></mrow>
<mo>=</mo>
<mfrac>
<mrow><mi>a</mi><mo>×</mo><mi>b</mi></mrow>
<mrow><mi>gcd</mi><mo>⁡</mo><mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo></mrow></mrow>
</mfrac>
</mrow>
</math>
lcm(a, b) = (a xx b) / (gcd(a, b))
a*b/GCD[a, b]
L := a*b/igcd(a, b);
L = a*b/gcd(a, b);
lcm(a, b) = (a × b)/gcd(a, b)
L = p_1^{a_1} \times p_2^{a_2} \times \cdots \times p_k^{a_k}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>L</mi>
<mo>=</mo>
<msubsup><mi>p</mi><mn>1</mn><msub><mi>a</mi><mn>1</mn></msub></msubsup>
<mo>×</mo>
<msubsup><mi>p</mi><mn>2</mn><msub><mi>a</mi><mn>2</mn></msub></msubsup>
<mo>×</mo>
<mo>⋯</mo>
<mo>×</mo>
<msubsup><mi>p</mi><mi>k</mi><msub><mi>a</mi><mi>k</mi></msub></msubsup>
</mrow>
</math>
L = p_1^(a_1) xx p_2^(a_2) xx cdots xx p_k^(a_k)
Product[p[i]^a[i], {i, 1, k}]
L := product(p[i]^a[i], i = 1 .. k);
L = prod(p.^a);
L = p_1^(a_1) × p_2^(a_2) × ⋯ × p_k^(a_k)
lcm(a, b, c) = lcm(lcm(a, b), c)
\mathrm{lcm}(a, b, c) = \mathrm{lcm}(\mathrm{lcm}(a, b),\ c)
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>lcm</mi><mo>⁡</mo>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>,</mo><mi>c</mi><mo>)</mo></mrow>
<mo>=</mo>
<mi>lcm</mi><mo>⁡</mo>
<mrow><mo>(</mo><mi>lcm</mi><mo>⁡</mo><mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>b</mi><mo>)</mo></mrow><mo>,</mo><mi>c</mi><mo>)</mo></mrow>
</mrow>
</math>
lcm(a, b, c) = lcm(lcm(a, b), c)
LCM[LCM[a, b], c]
L := ilcm(ilcm(a, b), c);
L = lcm(lcm(a, b), c);
lcm(a, b, c) = lcm(lcm(a, b), c)
How to have ChatGPT do the calculation
You are a calculation assistant for whole numbers. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing). For the four numbers 330, 75, 450 and 225, find each of the following: 1. The least common multiple (LCM) 2. The greatest common factor (GCF) 3. The prime factorization of each number Show the formulas you used and the numbers from the execution result.
How to Use
-
1Enter your numbersType the numbers you want to calculate with into the input fields
-
2CalculatePress the "Calculate" button
-
3Check the resultThe result appears on the spot. The same page also explains the idea behind the calculation and the formula
DataChef Features
No technical knowledge required.
Intuitive and user-friendly operation.
Can be used without registering personal information.
Automatic file deletion by clicking "download".
and rapid file conversion.
No attribution required.
No need to contact us for commercial use permission.
