HCF and LCM Calculator

HCF and LCM Calculator

The highest common factor, or HCF, of some numbers is the largest number that divides all of them exactly. The lowest common multiple, or LCM, is the smallest number that all of them divide into. They are used to simplify fractions, to add fractions with different denominators, and to solve problems about things that repeat together. This calculator finds both for two to ten whole numbers and shows the prime factors of each number as well. It runs in your browser and stores nothing.

How to use it

  1. Type two to ten whole numbers in the box, separated by commas or spaces.
  2. Click Find HCF and LCM.
  3. Read the HCF and the LCM at the top.
  4. Read the prime factors of each number below them, which show how the answers were found.

Worked example: 12, 18 and 24

Number Prime factors
12 2 squared times 3
18 2 times 3 squared
24 2 cubed times 3
HCF 6
LCM 72

The HCF takes the lowest power of each shared prime: one 2 and one 3, which gives 6. The LCM takes the highest power of every prime: 2 cubed and 3 squared, which gives 8 times 9, or 72. In a second test, 48 and 180 gave an HCF of 12 and an LCM of 720, and 7 and 13, which are both prime, gave an HCF of 1 and an LCM of 91. Zero, negative numbers and values with more than 15 digits are rejected with a message.

HCF by prime factors

Write each number as a product of primes. Choose the primes that appear in all of the numbers and take the smallest power of each. Multiply them to get the HCF. If the numbers have no prime in common, the HCF is 1, and the numbers are called coprime. This is why 7 and 13 have an HCF of 1.

LCM by prime factors

Take every prime that appears in any of the numbers, with the largest power in which it appears, and multiply them together. For two numbers, there is also a useful link: the product of the numbers equals the HCF times the LCM. For 48 and 180, the product is 8640, and 12 times 720 is also 8640. The tool uses the link to find the LCM, one pair at a time.

Where HCF and LCM are used

[object Object]

Example: two buses

One bus leaves a stop every 12 minutes and another every 18 minutes. If both leave together at 9:00, they will leave together again after the LCM of 12 and 18, which is 36 minutes, at 9:36. A different problem: a floor is 12 metres by 18 metres. The largest square tile that fits exactly has a side equal to the HCF, which is 6 metres. Seeing the difference between the two questions is the key to choosing HCF or LCM.

Limits of the tool

The numbers can have up to 15 digits. The HCF and LCM are exact for all of them. The list of prime factors is shown for numbers up to ten billion, because finding the factors of very large numbers by trial division takes too long in a browser. For larger numbers, the tool says that the factors are not shown, but it still gives the HCF and the LCM.

Tips

  • Check that the numbers are separated by commas or spaces.
  • Use whole numbers only. Decimals and fractions are not accepted.
  • For fractions, find the LCM of the denominators.
  • If the HCF is 1, the numbers share no factor except 1.

Privacy

The numbers stay in your browser and are not sent or stored.

Other ways to find the HCF

Besides prime factors, there is the Euclidean method, which divides the larger number by the smaller one and repeats with the remainder until it reaches zero. The last non-zero remainder is the HCF. It is very fast, even for huge numbers, and it is the method that the tool uses inside. For 48 and 180, the steps are 180 divided by 48 leaving 36, then 48 divided by 36 leaving 12, then 36 divided by 12 leaving 0, so the HCF is 12.

Common mistakes to avoid

  • Mixing up the HCF and the LCM.
  • Entering a zero or a negative number.
  • Typing decimals instead of whole numbers.
  • Forgetting that the LCM can be much larger than the numbers.

Frequently asked questions

What is the HCF?

It is the largest number that divides all the given numbers exactly. It is also called the GCD.

What is the LCM?

It is the smallest number that all the given numbers divide into.

Can I enter more than two numbers?

Yes. The tool accepts 2 to 10 numbers.

What if the HCF is 1?

The numbers are coprime. They share no factor except 1.

Is my data stored?

No. It stays in your browser.

Related tools and guides

This tool is provided for convenience. Check homework answers with your own working.

Leave a Comment

Your email address will not be published. Required fields are marked *

Privacy Policy | Terms of Use | Cookie Policy | Disclaimer | Ad and Affiliate Disclosure | Contact

🌐 Language:
Scroll to Top