Skip to main content
🔬 Advanced ✨ New

LCM Calculator – Least Common Multiple

Calculate the Least Common Multiple (LCM) of two or more numbers. Fast and accurate LCM finder. Use this free math calculator for instant results. No signup.

★★★★★ 4.8/5 · 📊 0 calculations · 🔒 Private & free

What is LCM (Least Common Multiple)?

The Least Common Multiple (LCM) of two or more integers is the smallest positive integer that is perfectly divisible by each of those integers — leaving no remainder. In other words, it is the smallest number that all of the given numbers can divide into evenly.

For example, consider the numbers 4 and 6. The multiples of 4 are: 4, 8, 12, 16, 20, 24 … The multiples of 6 are: 6, 12, 18, 24 … The first number that appears in both lists is 12, so LCM(4, 6) = 12.

LCM is one of the most fundamental concepts in number theory and arithmetic. It is closely related to the Greatest Common Divisor (GCD), also known as the Greatest Common Factor (GCF), through the elegant identity:

LCM(a, b) = |a × b| / GCD(a, b)

This relationship lets us compute LCM efficiently using Euclid's algorithm for GCD, which runs in logarithmic time even for very large integers. Our calculator uses precisely this approach to deliver instant, accurate results for any two positive integers you enter.

LCM is defined only for integers. For two positive integers, LCM is always at least as large as the larger of the two numbers, and at most equal to their product. If the two numbers share no common factors other than 1 (they are coprime), then LCM(a, b) = a × b.

How to Find LCM – Three Methods Explained

There are three standard methods to calculate LCM by hand. Understanding each method deepens your number sense and helps you choose the most efficient approach for a given problem.

<h3>Method 1: Listing Multiples</h3>
<p>Write out the multiples of each number until you find the first one they share. This works well for small numbers but becomes impractical for large ones.</p>
<p><strong>Example: LCM(6, 8)</strong></p>
<ul>
    <li>Multiples of 6: 6, 12, 18, <strong>24</strong>, 30 …</li>
    <li>Multiples of 8: 8, 16, <strong>24</strong>, 32 …</li>
    <li>LCM(6, 8) = <strong>24</strong></li>
</ul>

<h3>Method 2: Prime Factorization</h3>
<p>Break each number into its prime factors. Then take the <em>highest power</em> of each prime that appears in any factorization and multiply them together.</p>
<p><strong>Example: LCM(12, 18)</strong></p>
<ul>
    <li>12 = 2² × 3¹</li>
    <li>18 = 2¹ × 3²</li>
    <li>Take highest powers: 2² × 3² = 4 × 9 = <strong>36</strong></li>
    <li>LCM(12, 18) = <strong>36</strong></li>
</ul>

<h3>Method 3: Using GCD (Most Efficient)</h3>
<p>Apply the formula <strong>LCM(a, b) = (a × b) / GCD(a, b)</strong>. To find GCD, use Euclid's algorithm: repeatedly replace the larger number with the remainder when dividing the larger by the smaller, until you reach 0.</p>
<p><strong>Example: LCM(48, 36)</strong></p>
<ul>
    <li>GCD(48, 36): 48 = 1×36 + 12 → GCD(36, 12): 36 = 3×12 + 0 → GCD = 12</li>
    <li>LCM(48, 36) = (48 × 36) / 12 = 1728 / 12 = <strong>144</strong></li>
</ul>

<table>
    <thead><tr><th>Method</th><th>Best For</th><th>Speed</th></tr></thead>
    <tbody>
        <tr><td>Listing multiples</td><td>Small numbers (&lt;20)</td><td>Slow for large numbers</td></tr>
        <tr><td>Prime factorization</td><td>3+ numbers, educational use</td><td>Moderate</td></tr>
        <tr><td>GCD / Euclid's algorithm</td><td>Any size numbers, computing</td><td>Very fast (log n)</td></tr>
    </tbody>
</table>

LCM Reference Table – Common Number Pairs

The table below gives LCM values for frequently used number pairs. Use this as a quick reference when working on math problems, scheduling, or fraction arithmetic.

Number ANumber BGCDLCM
2316
46212
510510
69318
812424
912336
1015530
1218636
1520560
1421742
1624848
20301060
25355175
364812144
1007525300

Notice the pattern: when one number divides the other evenly (e.g., 5 and 10), the LCM is the larger number. When two numbers are coprime (share no common factors), the LCM equals their product.

LCM of Three or More Numbers

To find the LCM of three or more numbers, apply the associative property of LCM iteratively:

LCM(a, b, c) = LCM(LCM(a, b), c)

You can extend this to any number of integers. For example:

LCM(4, 6, 10)

  1. LCM(4, 6) = 12
  2. LCM(12, 10) = 60
  3. LCM(4, 6, 10) = 60

Alternatively, use prime factorization across all numbers simultaneously:

NumbersLCMNote
2, 3, 412LCM(2,3)=6; LCM(6,4)=12
3, 5, 7105All prime; product = LCM
4, 6, 8248 = 2³ dominates
6, 10, 15302×3×5 = 30
12, 15, 20602²×3×5 = 60

Real-World Applications of LCM

LCM might seem like an abstract mathematical concept, but it appears in many practical scenarios across daily life, engineering, and scheduling.

<h3>Adding and Subtracting Fractions</h3>
<p>To add fractions with unlike denominators, you must first find the <strong>Least Common Denominator (LCD)</strong> — which is simply the LCM of the denominators.</p>
<p>Example: 1/4 + 1/6. LCD = LCM(4, 6) = 12. So: 3/12 + 2/12 = 5/12.</p>
<p>Without LCM, fraction arithmetic requires working with unnecessarily large numbers. LCM keeps calculations as simple as possible.</p>

<h3>Scheduling and Synchronization</h3>
<p>LCM tells you when cyclical events will coincide. This is used in:</p>
<ul>
    <li><strong>Bus/train schedules:</strong> If Bus A departs every 12 minutes and Bus B every 8 minutes, they coincide every LCM(12, 8) = 24 minutes.</li>
    <li><strong>Gear systems:</strong> A gear with 12 teeth meshing with one that has 8 teeth returns to the original alignment every LCM(12, 8) = 24 rotations of the smaller gear.</li>
    <li><strong>Music and rhythm:</strong> A beat pattern of 3 and a beat pattern of 4 align every LCM(3, 4) = 12 beats — the basis of polyrhythm in music.</li>
    <li><strong>Blinking lights:</strong> Two traffic lights on cycles of 30s and 45s will both be green simultaneously every LCM(30, 45) = 90 seconds.</li>
</ul>

<h3>Cryptography and Modular Arithmetic</h3>
<p>In RSA encryption, Carmichael's totient function λ(n) is related to LCM. Specifically, λ(pq) = LCM(p−1, q−1) for distinct primes p and q. This LCM value is used to compute the encryption and decryption exponents in RSA, making LCM integral to internet security.</p>

<h3>Computer Science: Memory Alignment</h3>
<p>Computer memory addresses must often align to multiples of certain word sizes (e.g., 4 bytes or 8 bytes). When allocating shared memory structures that must be compatible with multiple data types, the starting address is aligned to LCM of the required alignments — preventing costly unaligned memory access penalties.</p>

LCM vs GCD – Key Differences

LCM and GCD are complementary concepts that together capture the multiplicative structure of integers. Understanding both deepens mathematical intuition.

PropertyLCMGCD
Full nameLeast Common MultipleGreatest Common Divisor
DefinitionSmallest positive multiple of bothLargest positive divisor of both
Range≥ max(a, b)≤ min(a, b)
Coprime numbersLCM(a,b) = a × bGCD(a,b) = 1
Key formulaLCM = a×b / GCDUse Euclidean algorithm
Primary useFraction denominators, schedulingSimplifying fractions, factoring
Example (12, 18)LCM = 36GCD = 6
Product relationshipLCM × GCD = a × bGCD × LCM = a × b

The key identity LCM(a,b) × GCD(a,b) = a × b always holds for positive integers. This means knowing one immediately gives you the other if you know the original numbers.

For example: LCM(12, 18) = 36 and GCD(12, 18) = 6. Check: 36 × 6 = 216 = 12 × 18. ✓

Special Cases and Edge Conditions

Understanding the boundary cases of LCM helps avoid common errors in calculations and programming.

Special CaseInputLCM ResultReason
Same numbersLCM(5, 5)5A number is its own LCM
One is multiple of otherLCM(3, 9)99 already divisible by 3
Coprime numbersLCM(7, 11)77No shared factors → product
One is 1LCM(1, 100)1001 divides everything
Powers of same primeLCM(8, 16)16Highest power wins

LCM in Grade School Mathematics

LCM is introduced in elementary and middle school mathematics curricula, primarily in the context of fraction arithmetic. Here's how it fits into the standard progression:

A common classroom technique is the "ladder method" (also called the "cake method" or "box method"): divide both numbers by shared prime factors simultaneously, continuing until the remaining numbers share no common factors, then multiply all the divisors and remaining numbers together.

Ladder method example: LCM(24, 36)

  2 | 24  36
  2 | 12  18
  3 |  6   9
    |  2   3
LCM = 2 × 2 × 3 × 2 × 3 = 72
    

Verify: LCM(24, 36) = (24 × 36) / GCD(24, 36) = 864 / 12 = 72. ✓

Frequently Asked Questions

What is LCM of 12 and 18?

LCM(12, 18) = 36. Using prime factorization: 12 = 2² × 3 and 18 = 2 × 3². Taking the highest powers: 2² × 3² = 4 × 9 = 36. Verify: 36 ÷ 12 = 3 and 36 ÷ 18 = 2, both whole numbers. ✓

What's the difference between LCM and GCF?

LCM (Least Common Multiple) is the smallest positive number that is a multiple of both given numbers. GCF (Greatest Common Factor, also called GCD) is the largest positive number that divides both given numbers. For LCM(4,6)=12 and GCF(4,6)=2. They are related by: LCM × GCF = a × b (so 12 × 2 = 24 = 4 × 6 ✓).

Can LCM be one of the numbers?

Yes! If one number is a multiple of the other, the LCM equals the larger number. For example, LCM(3, 9) = 9 because 9 is already a multiple of 3. Similarly, LCM(5, 15) = 15 and LCM(7, 49) = 49.

What is LCM(0, n)?

By convention, LCM(0, n) = 0 for any integer n. This is because 0 is considered a multiple of every integer (0 = 0 × n), and any common multiple of 0 and n must be a multiple of both — but the only multiple of 0 is 0 itself.

How do I find LCM of fractions?

LCM of fractions follows the formula: LCM(a/b, c/d) = LCM(a, c) / GCD(b, d). For example, LCM(1/2, 1/3) = LCM(1,1) / GCD(2,3) = 1/1 = 1. This is used in advanced algebra when finding LCDs for algebraic fractions.

What is the LCM of two prime numbers?

The LCM of any two distinct prime numbers is their product, since primes have no common factors. LCM(7, 11) = 77; LCM(13, 17) = 221. If the two primes are the same number (e.g., LCM(5, 5) = 5), then LCM equals the prime itself.

How does LCM relate to adding fractions?

To add fractions like 3/4 + 5/6, find the Least Common Denominator (LCD), which equals LCM(4, 6) = 12. Convert: 3/4 = 9/12 and 5/6 = 10/12. Then add: 9/12 + 10/12 = 19/12. Using LCM ensures you work with the simplest possible common denominator.

Can LCM be larger than the product of two numbers?

No. LCM(a, b) ≤ a × b always. The LCM equals the product only when GCD = 1 (the numbers are coprime). For all other cases, LCM is strictly less than the product. For example, LCM(4, 6) = 12 < 4 × 6 = 24.

What is the LCM of 1 through 10?

LCM(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) = 2520. This is the smallest number divisible by all integers from 1 to 10. It equals 2³ × 3² × 5 × 7 = 8 × 9 × 5 × 7 = 2520. This result appears in combinatorics and number theory proofs.

Is there a quick mental math trick for LCM?

Yes! For two numbers: (1) If one divides the other, LCM = the larger one. (2) For small numbers, check if the larger number is divisible by the smaller — if yes, that's your LCM; if not, try 2×, 3×, 4× the larger number. (3) For coprime numbers (no shared factors), LCM = their product. These three rules handle most everyday cases instantly.

LCM in Programming and Software Development

LCM appears frequently in programming tasks, from algorithm design to system scheduling. Here's how it's commonly implemented and used in code:

Efficient LCM computation using GCD (Python):

from math import gcd

def lcm(a, b):
    return abs(a * b) // gcd(a, b)

# LCM of multiple numbers:
from functools import reduce
def lcm_multiple(*nums):
    return reduce(lcm, nums)

# Examples:
print(lcm(12, 18))        # 36
print(lcm_multiple(4, 6, 10))  # 60

Common programming applications:

In Python 3.9+, math.lcm() was added to the standard library, supporting multiple arguments: math.lcm(4, 6, 10) returns 60. Before 3.9, developers used the formula abs(a*b)//gcd(a,b) or the reduce pattern shown above.

LCM Practice Problems with Solutions

Test your understanding with these practice problems, each demonstrating a different scenario where LCM calculation is needed:

#ProblemLCM CalculationAnswer
1Bus A arrives every 8 min. Bus B every 12 min. When do they both arrive at the same time?LCM(8,12): 8=2³, 12=2²×3 → 2³×3=2424 minutes
2Add fractions: 5/6 + 3/8LCD = LCM(6,8)=24; 20/24+9/24=29/2429/24 = 1 5/24
3Gears: 15 teeth and 20 teeth. How many rotations until both return to start?LCM(15,20)=60 teeth; 60/15=4 rotations of gear A4 rotations
4Light A blinks every 4s, B every 6s, C every 10s. When do all blink together?LCM(4,6,10)=60Every 60 seconds
5Simplify: LCM(36, 48, 60)LCM(36,48)=144; LCM(144,60)=720720

For problem 5 verification: 720 ÷ 36 = 20 ✓; 720 ÷ 48 = 15 ✓; 720 ÷ 60 = 12 ✓. All three divide evenly. And 720 is the smallest such number (try 360: 360 ÷ 48 = 7.5 ✗). These problem types — scheduling, fraction arithmetic, and gear systems — represent the three most common real-world LCM applications you'll encounter.

More practice: LCM(100, 75) = ? Using GCD: GCD(100, 75) = 25; LCM = (100×75)/25 = 7500/25 = 300. Check: 300÷100=3 ✓; 300÷75=4 ✓. LCM(21, 35) = ? GCD(21,35)=7; LCM=(21×35)/7=735/7=105. Check: 105÷21=5 ✓; 105÷35=3 ✓. The GCD method is reliably the fastest approach for any pair of integers, regardless of size. A final note on efficiency: for very large numbers (hundreds of digits), even Euclid's algorithm uses the extended GCD or binary GCD variant for efficiency. Python's math.gcd() and math.lcm() use optimized C implementations that handle arbitrarily large integers instantly — which is why our online calculator can also handle large inputs without performance issues.

},{"@type":"Question","name":"What's the difference between LCM and GCF?","acceptedAnswer":{"@type":"Answer","text":"LCM (Least Common Multiple) is the smallest shared multiple. GCF (Greatest Common Factor) is the largest shared factor. For example, LCM(4,6)=12 and GCF(4,6)=2."}},{"@type":"Question","name":"Can LCM be one of the numbers?","acceptedAnswer":{"@type":"Answer","text":"Yes, if one number is a multiple of the other. For example, LCM(3, 9) = 9."}}]}