LCM & GCF Calculator – Least Common Multiple & Greatest Common Factor
Enter integers separated by commas, spaces, or new lines. We’ll compute the least common multiple (LCM) and greatest common factor (GCF/HCF) for the whole list.
How It Works
We use the Euclidean Algorithm for GCF/HCF and the identity \( \text{LCM}(a,b) = \dfrac{|a \cdot b|}{\text{GCF}(a,b)} \). For many numbers \(a_1,\dots,a_n\), we reduce pairwise: \( \text{GCF}(a_1,\dots,a_n) = \text{GCF}(\dots\text{GCF}(a_1,a_2),\dots,a_n) \) and \( \text{LCM}(a_1,\dots,a_n) = \text{LCM}(\dots\text{LCM}(a_1,a_2),\dots,a_n) \).
- Zeros: \( \gcd(a,0)=|a| \); \( \operatorname{lcm}(0,n)=0 \) if any input is zero.
- Negatives: Signs don’t matter for final results; we use absolute values.
- Large integers: When needed, we switch to precise
BigInt
arithmetic.
Frequently Asked Questions
Which separators can I use?
Commas, spaces, or new lines. Extra whitespace is ignored.
Can I enter negative numbers or zero?
Yes. We use absolute values for GCF/LCM. Zeros are allowed; if any number is zero, the LCM of the list is zero.
What if I enter only one number?
Then GCF = |n| and LCM = |n|.
Privacy?
Everything runs in your browser; nothing is uploaded.