Omni Calculator logo

Greatest Common Factor Calculator

Created by Krishna Nelaturu
Reviewed by Komal Rafay
Last updated: Jan 18, 2024


You can use our greatest common factor calculator to find the greatest common factor (GCF) of a given set of numbers. Finding the GCF is critical for reducing fractions or finding the least common multiple of two numbers. However, it can be tedious to find the GCF of large numbers, say 10144 and 12408, through manual calculations. And that's where this calculator shines - instantly, you can use our greatest common factor finder to find the GCF between any two numbers!

In the following article, you shall learn answers to some fundamental questions, like what is the greatest common factor and how to calculate it.

What is the greatest common factor?

The greatest common factor of a given set of positive numbers is the largest positive integer that divides them without leaving a remainder.

For example, consider the numbers 45 and 189. The greatest positive integer that can divide them both is 9. Hence, we say that the greatest common factor of 45 and 189 is 9.

We can illustrate the GCF of two numbers, A and B, as GCF(A, B).

How to find the greatest common factor

There are several methods to find the greatest common factor of two numbers:

  • List all factors;
  • Prime factorization method;
  • Euclidean algorithm;
  • Binary algorithm; and
  • Using some properties of GCF.

Let's briefly get acquainted with each method.

Listing all factors

This method involves two basic steps. Let's explore them with the help of our previous example:

  1. List all possible factors for each number:
    • 45:1,3,5,9,15,4545: 1, 3, 5, 9, 15, 45.
    • 189:1,3,7,9,21,27,63,189189: 1, 3, 7, 9, 21, 27, 63, 189.
  2. List all common factors for these numbers in ascending order: 1,3,91, 3, 9.
  3. The largest number in this list is the greatest common factor: 99.

This method is the most straightforward approach to the problem. But as you may have observed, it can be tedious to perform manually for large numbers.

Prime factorization method

In this method, we prime factorize the numbers, i.e., we only list the prime factors of the numbers. Applying this method to the same example:

  1. Prime factorize the numbers:
    • 45=3×3×545 = 3 × 3 × 5; and
    • 189=3×3×3×7189 = 3 × 3 × 3 × 7;
  2. Gather the common prime factors: 3×33 × 3;
  3. Multiply the common prime factors to find the GCF: 3×3=93 × 3 = 9.

Euclidean algorithm

Euclidean algorithm method relies on the principle that the GCF of two given numbers must also be the GCF of the two numbers and the difference between those numbers:

GCF(A,B)=GCF(A,B,AB)\rm{GCF}(A,B) = GCF(A, B, A-B)

A faster version of this algorithm utilizes the modulo operation rather than subtraction. Looking at our example, GCF(45, 189):

  1. Take the smaller number as the divisor and perform the modulo operation:
    189mod45=9189 \mod 45 = 9.
  2. Take the previous divisor and the modulo remainder in a new list:
    45,945, 9.
  3. Take the smaller number in this list as the divisor and perform the modulo operation:
    45mod9=045 \mod 9 =0.
  4. Since the remainder is 00, we can stop. The last modulo divisor, 99, is the GCF of 45 and 189.

Binary algorithm for GCF

This algorithm follows these simple rules:

  1. If A and B are even, GCF(A,B)=GCF(A/2,B/2)\rm{GCF}(A,B) = GCF(A/2, B/2).
  2. If only A is even, GCF(A,B)=GCF(A/2,B)\rm{GCF}(A,B) = GCF(A/2, B).
  3. If A and B are odd and A>B, GCF(A,B)=GCF((AB)/2,B)\rm{GCF}(A, B) = GCF((A-B)/2, B).
  4. GCF(0,A)=A\rm{GCF}(0, A) = A.

The binary algorithm dictates that we repeat steps 1-3 until we A = B or the condition in step 4 occurs. Let's look at our two numbers, 45 and 189:

  1. Both numbers are odd:
    GCF(45,189)=GCF((18945)/2,45)=GCF(72,45)\rm{GCF}(45, 189) = GCF((189-45)/2, 45) = GCF(72,45)
  2. Only one number is even: GCF(72,45)=GCF(72/2,45)=GCF(36,45)\rm{GCF(72, 45) = GCF(72/2, 45)= GCF(36, 45)}
  3. Only one number is even: GCF(36,45)=GCF(36/2,45)=GCF(18,45)\rm{GCF(36, 45) = GCF(36/2, 45) = GCF(18, 45)}
  4. Only one number is even: GCF(18,45)=GCF(18/2,45)=GCF(9,45)\rm{GCF(18, 45) = GCF(18/2, 45) = GCF(9, 45)}
  5. Both numbers are odd: GCF(9,45)=GCF((459)/2,9)=GCF(18,9)\rm{GCF(9, 45) = GCF((45-9)/2, 9) = GCF(18,9)}
  6. Only one number is even: GCF(18,9)=GCF(18/2,9)=GCF(9,9)\rm{GCF(18, 9) = GCF(18/2, 9) = GCF(9, 9)}
  7. Since both numbers are the same, we can stop here:
    GCF(45,189)=9\rm{GCF(45, 189) = 9}

Using this greatest common factor calculator

Our greatest common factor calculator is easy to use:

  1. Simply enter the list of (up to fifteen) numbers in any order. The tool will calculate the greatest common factor of these numbers.
  2. Want to check step-by-step solutions? Choose the method from the drop-down list, and our greatest common factor finder will make it happen in a snap!

Other relevant tools

Check out other tools from Omni that perform similar calculations:

FAQ

What is the GCF of 8 and 12?

The greatest common factor of 8 and 12 is 4. To arrive at this answer, you need to follow these steps:

  1. List all factors for both numbers:
    • 8: 1, 2, 4, 8.
    • 12: 1, 2, 3, 4, 6, 12.
  2. Gather the common factors between the two numbers: 1, 2, 4.
  3. 4 is the largest in this list, hence the greatest common factor of 8 and 12.
  4. Verify the calculation and solution steps with our greatest common factor calculator.

What is the greatest common factor of two co-prime numbers?

The greatest common factor of any two co-prime numbers is 1. This is because, by definition, co-prime numbers have only 1 as the common factor between them.

Krishna Nelaturu
Data (You may enter up to 15 integers)
#1
#2
Step by step solution?
Choose method:
None
Check out 75 similar arithmetic calculators ➗
Absolute changeAbsolute valueAdding and subtracting fractions… 72 more
People also viewed…

Books vs e-books

Discover the ultimate paper books vs. e-books calculator. Make an informed choice with our handy tool. Find out which is best for the environment!

Car heat

The hot car calculator shows how fast a car's interior heats up during a summer day.

Integration by completing the square

Let's learn how to integrate rational functions by completing the square and substitution.

Midsegment of a triangle

The midsegment of a triangle calculator helps you to quickly find the length of a midsegment. Works even if you know only the vertices!
Copyright by Omni Calculator sp. z o.o.
Privacy, Cookies & Terms of Service