Skip to main content

GCF and LCM Calculator

Solve gcfand lcmcalculator problems step-by-step with our free calculator. See formulas, worked examples, and clear explanations.

Share this calculator

Formula

GCF: product of common prime factors with lowest exponents | LCM: product of all prime factors with highest exponents

For two numbers a and b: GCF(a,b) x LCM(a,b) = a x b. The GCF uses the Euclidean algorithm (repeated division), while the LCM can be derived from the GCF using LCM(a,b) = |a x b| / GCF(a,b).

Worked Examples

Example 1: GCF and LCM of Two Numbers

Problem: Find the GCF and LCM of 48 and 36.

Solution: Prime factorization: 48 = 2^4 x 3, 36 = 2^2 x 3^2\nGCF = 2^2 x 3 = 12 (take lowest powers of shared primes)\nLCM = 2^4 x 3^2 = 144 (take highest powers of all primes)\nVerification: GCF x LCM = 12 x 144 = 1,728 = 48 x 36

Result: GCF = 12 | LCM = 144

Example 2: GCF and LCM of Three Numbers

Problem: Find the GCF and LCM of 12, 18, and 24.

Solution: Prime factorizations: 12 = 2^2 x 3, 18 = 2 x 3^2, 24 = 2^3 x 3\nGCF: lowest powers of shared primes = 2^1 x 3^1 = 6\nLCM: highest powers of all primes = 2^3 x 3^2 = 72\nAll three numbers divide evenly into 72: 72/12=6, 72/18=4, 72/24=3

Result: GCF = 6 | LCM = 72

Frequently Asked Questions

What is the Greatest Common Factor (GCF)?

The Greatest Common Factor, also known as the Greatest Common Divisor (GCD) or Highest Common Factor (HCF), is the largest positive integer that divides two or more numbers without leaving a remainder. For example, the GCF of 12 and 18 is 6 because 6 is the largest number that divides both 12 and 18 evenly. Finding the GCF is essential in simplifying fractions, factoring polynomials, and solving problems in number theory. The Euclidean algorithm is the most efficient classical method for computing the GCF of two numbers.

What is the Least Common Multiple (LCM)?

The Least Common Multiple is the smallest positive integer that is divisible by each of the given numbers. For instance, the LCM of 4 and 6 is 12 because 12 is the smallest number that both 4 and 6 divide into evenly. The LCM is widely used when adding or subtracting fractions with different denominators, scheduling recurring events, and solving problems involving periodicity. You can compute the LCM using prime factorization by taking the highest power of each prime factor that appears in any of the numbers.

How are GCF and LCM related to each other?

For any two positive integers a and b, the product of their GCF and LCM equals the product of the two numbers: GCF(a, b) times LCM(a, b) equals a times b. This elegant relationship allows you to compute one value if you know the other. For example, if a equals 12 and b equals 18, then GCF is 6 and LCM is 36, and 6 times 36 equals 216 which is 12 times 18. This property only holds exactly for two numbers; for three or more numbers the relationship requires inclusion-exclusion adjustments.

How does the Euclidean algorithm find the GCF?

The Euclidean algorithm is one of the oldest algorithms in mathematics, dating back over 2,300 years. It works by repeatedly dividing the larger number by the smaller one and replacing the larger number with the remainder. The process continues until the remainder is zero, at which point the last non-zero remainder is the GCF. For example, to find GCF(48, 18): 48 divided by 18 gives remainder 12, then 18 divided by 12 gives remainder 6, then 12 divided by 6 gives remainder 0, so the GCF is 6. This algorithm is extremely efficient even for very large numbers.

How do you find the GCF using prime factorization?

To find the GCF using prime factorization, first break each number down into its prime factors. Then identify all the prime factors that appear in every number and take the lowest power of each shared prime. For example, 12 equals 2 squared times 3, and 18 equals 2 times 3 squared. The shared primes are 2 and 3. The lowest power of 2 is 1 and the lowest power of 3 is 1, so GCF equals 2 times 3 which is 6. This method is intuitive and works well for smaller numbers, though the Euclidean algorithm is faster for larger numbers.

What are practical applications of GCF and LCM?

GCF and LCM appear throughout mathematics and everyday life. The GCF is used to simplify fractions (divide numerator and denominator by their GCF), distribute items into equal groups, and tile floors with the largest possible square tiles. The LCM is used to find common denominators when adding fractions, synchronize repeating schedules (like when two buses will arrive together again), and determine gear ratios in mechanical engineering. In computer science, the GCF is fundamental to cryptographic algorithms like RSA.

References