Last updated
LCM of Two Numbers
Find the Least Common Multiple of 12 and 18:
Input: 12, 18
Step 1 — Prime factorization:
12 = 2² × 3
18 = 2 × 3²
Step 2 — Take highest power of each prime:
2² × 3² = 4 × 9 = 36
LCM(12, 18) = 36
Verification: 36 ÷ 12 = 3 ✓ and 36 ÷ 18 = 2 ✓. Both divide evenly, confirming 36 is a common multiple. It is the smallest such number.
LCM of Three Numbers
Find the LCM of 4, 6, and 10:
Input: 4, 6, 10
Prime factorizations:
4 = 2²
6 = 2 × 3
10 = 2 × 5
Highest powers: 2² × 3 × 5 = 4 × 3 × 5 = 60
LCM(4, 6, 10) = 60
Verification: 60 ÷ 4 = 15 ✓, 60 ÷ 6 = 10 ✓, 60 ÷ 10 = 6 ✓
Synchronizing Periodic Events
Two background jobs run at different intervals. Job A runs every 4 minutes, Job B runs every 6 minutes. When will they next run at the same time?
Input: 4, 6
LCM(4, 6) = 12
They will next coincide after 12 minutes.
This is useful in scheduling systems, cron job planning, and any scenario where you need to know when multiple periodic processes will align.
Adding Fractions — Finding the Common Denominator
To add 1/4 + 1/6, find the LCM of the denominators:
LCM(4, 6) = 12
Convert fractions:
1/4 = 3/12
1/6 = 2/12
Sum: 3/12 + 2/12 = 5/12
Using the LCM as the common denominator gives the simplest possible result. Using 24 (another common multiple) would give 6/24 + 4/24 = 10/24, which simplifies to 5/12 — the same answer but requiring an extra simplification step.
LCM of Large Numbers
Find the LCM of 84 and 120:
Input: 84, 120
Prime factorizations:
84 = 2² × 3 × 7
120 = 2³ × 3 × 5
Highest powers: 2³ × 3 × 5 × 7 = 8 × 3 × 5 × 7 = 840
LCM(84, 120) = 840
GCD(84, 120) = 12
Verification: GCD × LCM = 84 × 120
12 × 840 = 10,080 = 84 × 120 ✓
LCM Using the GCD Relationship
The calculator also shows the GCD-based formula: LCM(a, b) = |a × b| / GCD(a, b)
Input: 36, 48
GCD(36, 48) = 12
LCM = (36 × 48) / 12
= 1728 / 12
= 144
LCM(36, 48) = 144
This formula is efficient for large numbers where prime factorization would be tedious.
Animation Cycle Synchronization
Three CSS animations have different durations: 3 seconds, 4 seconds, and 5 seconds. When will all three animations be at their starting position simultaneously?
Input: 3, 4, 5
LCM(3, 4, 5) = 60
All three animations will align every 60 seconds.
This is useful in game development and UI animation when you need to know the overall cycle length of a complex animation system with multiple independently looping elements.
Real-Time System Hyperperiod
In a real-time system, three tasks have periods of 20ms, 50ms, and 100ms. The hyperperiod (the scheduling analysis window) is their LCM:
Input: 20, 50, 100
Prime factorizations:
20 = 2² × 5
50 = 2 × 5²
100 = 2² × 5²
LCM = 2² × 5² = 4 × 25 = 100
Hyperperiod = 100ms
Within each 100ms window, Task A runs 5 times, Task B runs 2 times, and Task C runs once. This analysis is fundamental for schedulability testing in embedded and real-time systems.
LCM of Five Numbers
Find the LCM of 2, 3, 4, 5, and 6:
Input: 2, 3, 4, 5, 6
Prime factorizations:
2 = 2
3 = 3
4 = 2²
5 = 5
6 = 2 × 3
Highest powers: 2² × 3 × 5 = 60
LCM(2, 3, 4, 5, 6) = 60
This is the smallest number divisible by all integers from 2 to 6. Useful in problems involving fractions with denominators 2 through 6.
Music — Polyrhythm Cycle Length
A musical piece has two rhythmic patterns: one repeating every 3 beats and another every 4 beats. When do they align?
Input: 3, 4
LCM(3, 4) = 12
The patterns align every 12 beats.
In a 3-against-4 polyrhythm:
Pattern A (3-beat): |1-2-3|1-2-3|1-2-3|1-2-3|
Pattern B (4-beat): |1-2-3-4|1-2-3-4|1-2-3|
Both start together at beat 1 and beat 13.
This concept is used in music composition and in understanding the structure of complex polyrhythmic patterns in jazz, African drumming, and contemporary classical music.