GCF calculator

Other tools

Area calculator{$ ',' | translate $} Perimeter calculator{$ ',' | translate $} Volume calculator{$ ',' | translate $} Multiplication chart{$ ',' | translate $} Periodic table{$ ',' | translate $} Matrix calculator{$ ',' | translate $} LCM calculator{$ ',' | translate $} Trigonometry calculator{$ ',' | translate $}

Greatest common factor calculator

Greatest common factor calculator

Before proceeding to the definition of the concept of the greatest common divisor (GCD), it is necessary to understand what a common divisor is in general.

It is known that an integer can have multiple divisors. We are interested in the simultaneous access to them by several integers. We consider the common divisor of several integers to be the number that can act as a divisor for each number from the specified series.

For example, the numbers 8 and 12 have the following common divisors: 1 and 4. This can be easily verified by writing mathematical expressions: 8 = 4 ⋅ 2; 12 = 3 ⋅ 4.

It should be noted that each number initially has at least two common divisors: any number is divisible by itself without a remainder, and is also divisible by 1.

Determining the Greatest Common Divisor

The Greatest Common Divisor (GCD) of two natural numbers is the largest of the natural numbers by which we can divide two of our numbers. If the value of the greatest common divisor of two natural numbers is 1, then we call these numbers coprime.

For two numbers a and b, the greatest common divisor is the number by which a and b can be divided without a remainder. This expression is written as follows: gcd (a, b) = c.

Another way to write GCD: (a, b) = c. However, in most cases, the first option is used.

So, for example, the numbers 4 and 16 have the greatest common divisor equal to 4. Let's write: gcd (4, 16) = 4.

Let's describe how we came to this result:

  • We wrote out all the divisors of the number 4. We got: 4, 2, 1.
  • Next, we painted all the divisors of 16. We got: 16, 8, 4, 2, 1.
  • We chose divisors that are common for both 4 and 16. We got: 4, 2, 1.
  • From the resulting common divisors, the largest was chosen. This is 4.
  • We get the answer: for numbers 4 and 16 GCD is 4.

Similarly, you can find the GCD for three or more integers. In this case, it will be the largest integer by which you can divide all the numbers from the proposed series.

So, for example, the largest divisor for the integers 6, 12, 18, 42 will be the number 6, that is, gcd (6, 12, 18, 42) = 6. The answer was obtained using an algorithm similar to what was described above - for numbers from a series, all divisors were sequentially written out, after which the largest of them were selected.

GCD properties

The greatest common divisor has a number of properties that will be relevant for GCD of positive integers with divisors greater than zero.

Property 1

From changing places of numbers, the final value of GCD will not change. You can write this statement like this:

  • gcd(a, b) = gcd(b, a).

Property 2

If a is divisible by b, then the set of common divisors of a and b is the same as the set of divisors of b. Written like this:

  • gcd(a, b) = b.

The proven greatest divisor property can be used to find the gcd of two numbers when one of them is divisible by the other. In this case, the GCD is equal to one of these numbers, by which another number is divisible.

For example:

  • gcd(12, 4) = 4.

Similar:

  • gcd(10, 1) = 1.

Property 3

If a = bq + c, where a, b, c and q are integers, then the set of common divisors of a and b is the same as the set of common divisors of b and c.

The equality gcd (a, b) = gcd (b, c) becomes valid.

Property 4

The expression gcd(ma, mb) = m ⋅ gcd(a, b) is true provided that m is any natural number.

Property 5

Let's say p is any common divisor of a and b.

Then:

  • gcd(a / p, b / p) = gcd(a, b) / p.

If p = gcd(a, b), we get:

  • gcd (a / gcd (a, b), b / gcd (a, b)) = 1,

Thus, numbers a / gcd (a, b) and b / gcd (a, b) are coprime.

Property 6

Any two numbers have at least one common divisor - this is the number 1.

Knowledge of the theoretical foundations of the GCD concept, as well as practical skills in its definition, are necessary in order to work with ordinary fractions. In addition, GCD is closely related to another mathematical unit - the least common divisor. Both definitions are usually studied as part of a standard school curriculum.

How to find the greatest common factor (GCF)

How to find the greatest common factor (GCF)

Finding the greatest common divisor (gcd) is a fairly popular task. This action helps us to carry out calculations in which ordinary fractions appear.

Methods for finding GCD

There are several tricks to find the greatest common divisor. We will consider the most popular of them.

Finding the GCD with decomposition of numbers into prime factors

This method is one of the most frequently used in solving mathematical problems.

The algorithm for determining GCD with decomposition into prime factors consists of the following steps:

  • We represent numbers as prime factors. For example, the number 20 can be represented as a product of 2 ⋅ 2 ⋅ 5.
  • Select the factors that will be present in both expansions.
  • Find the product of these factors.

Let's consider a few examples of the application of this algorithm in practice:

Determine the GCD of numbers 12 and 8.

Decompose 12 and 8 into prime factors:

  • 12 = 2 ⋅ 2 ⋅ 3.
  • 8 = 2 ⋅ 2 ⋅ 2.

We look at what factors are present in both expansions. Find: 2 and 2.

We multiply the factors and get:

  • 2 ⋅ 2 = 4.

Answer: gcd (12, 8) = 4.

Determine the GCD of the numbers 75 and 150.

The solution sequence is similar to the previous example.

Let's represent 75 and 150 as prime factors:

  • 75 = 3 ⋅ 5 ⋅ 5.
  • 150 = 2 ⋅ 3 ⋅ 5 ⋅ 5.

Determine the factors repeated in both expansions: 3, 5 and 5.

We multiply the resulting numbers together: 3 ⋅ 5 ⋅ 5 = 75.

Answer: gcd (75, 150) = 75.

Determine the GCD of the numbers 9 and 5.

This example uses prime numbers whose multiplier can only be 1.

When factoring 9 and 5 into prime factors, we will see that they do not have the same factors:

  • 5 = 5.
  • 9 = 3 ⋅ 3.

It must be remembered that this case is special. Such numbers are coprime, and their common divisor is one.

Euclid's algorithm

This algorithm was named after the ancient Greek mathematician Euclid, who first described it in his writings (7th and 10th books of the "Beginnings"). It is known that Euclid was not the author of this algorithm. Nevertheless, it is considered one of the oldest algorithms in use today.

Euclid's algorithm makes it easy to calculate the greatest common divisor of two positive numbers.

To find GCD (a, b), this algorithm looks like this:

  • If a = 0 then gcd(a, b) = b because gcd(0, b) = b and the algorithm stops.
  • If b = 0 then gcd(a, b) = a because gcd(a, 0) = a and the algorithm stops.
  • Divide a by b with remainder (a = b ⋅ q + r)
  • Find gcd(b, r) using Euclid's algorithm because gcd(a, b) = gcd(b, r).

In order to verify the effectiveness of the method in practice, consider an example.

It is necessary to determine the GCD of the numbers 270 and 192.

  • a = 270, b = 192.
  • a ≠ 0.
  • b ≠ 0.

Divide a by b, we get:

  • 270 / 192 = 1 (the remainder is 78).

You can write the result as: 270 = 192 ⋅ 1 + 78.

Next, we will calculate gcd (192, 78), since gcd (270, 192) = gcd (192, 78).

Let's move on.

  • a = 192, b = 78.
  • a ≠ 0.
  • b ≠ 0.

Divide a by b, we get:

  • 192 / 78 = 2 (the remainder is 36).

Can be written as:

  • 192 = 78 ⋅ 2 + 36.

Compute gcd(78, 36) since gcd(192, 78) = gcd(78, 36).

  • a = 78, b = 36.
  • a ≠ 0.
  • b ≠ 0.

Divide a by b, we get:

  • 78 / 36 = 2 (the remainder is 0).

Let's write the result as:

  • 78 = 36 ⋅ 2 + 6.

Calculate gcd(36, 6) since gcd(78, 36) = gcd(36, 6).

  • a = 36, b = 6.
  • a ≠ 0.
  • b ≠ 0.

Divide A by B, we get 36 / 6 = 6 (the remainder is 0).

Write the result in the following form:

  • 36 = 6 ⋅ 6 + 0.

Next we find gcd(6, 0) since gcd(36, 6) = gcd(6, 0).

  • a = 6, b = 0.
  • a ≠ 0.
  • b = 0.

As a result we have:

  • gcd(6, 0) = 6.

Thus, we have the following sequence of calculations:

  • gcd(270, 192) = gcd(192, 78) = gcd(78, 36) = gcd(36, 6) = gcd(6, 0) = 6.

As a result, we have the answer:

  • gcd(270, 192) = 6.

Each of the search methods discussed above has its advantages and disadvantages. The first method is great for working with relatively simple examples, unlike the second, which can be used to solve more complex mathematical problems.