GCD Calculator

Enter a set of numbers and calculate their greatest common divisor.

Greatest Common Divisor Calculator

Result

What is the Greatest Common Divisor (GCD)?

The Greatest Common Divisor (GCD) is the largest positive integer that divides all the numbers in a given set without leaving a remainder. The GCD is commonly used in mathematics for simplifying fractions and solving distribution problems.

How to Calculate the Greatest Common Divisor?

There are two main methods for calculating the GCD of a set of numbers:

1. Listing Method

Steps:

  1. List the factors of each number.
  2. Identify the common factors.
  3. Choose the largest common factor as the GCD.

Example: Find the GCD of 12 and 16.

Solution:

Factors of 12: 1, 2, 3, 4, 6, 12

Factors of 16: 1, 2, 4, 8, 16

Common factors: 1, 2, 4

GCD: 4

2. Euclidean Algorithm (Division Method)

Steps:

  1. Divide the larger number by the smaller number and note the remainder.
  2. Divide the smaller number by the remainder.
  3. Repeat the process until the remainder is 0, and the last non-zero remainder is the GCD.

Example: Find the GCD of 84 and 30.

Solution:

84 ÷ 30 = 2 remainder 24

30 ÷ 24 = 1 remainder 6

24 ÷ 6 = 4 remainder 0

GCD: 6

Complex Example: Find the GCD of 48, 180, and 240.

Solution:

1. First, find the GCD of 48 and 180:

180 ÷ 48 = 3 remainder 36

48 ÷ 36 = 1 remainder 12

36 ÷ 12 = 3 remainder 0

So, GCD(48, 180) = 12.

2. Now, find the GCD of 12 and 240:

240 ÷ 12 = 20 remainder 0

So, GCD(12, 240) = 12.

Thus, the GCD of 48, 180, and 240 is 12.

Differences in Calculating GCD for Two Numbers vs. Multiple Numbers

  • For Two Numbers: Calculating the GCD of two numbers is straightforward. You can use either of the two methods mentioned above to quickly get the result.
  • For Multiple Numbers: When calculating the GCD for multiple numbers, you can apply the Euclidean algorithm or listing method step by step. Typically, you start by calculating the GCD of the first two numbers, then use the result to find the GCD with the next number, and so on until all numbers are processed. This works because the GCD is transitive: GCD(a, b, c) = GCD(GCD(a, b), c)

Input Format

You can input a set of numbers, and the calculator will automatically handle the following common delimiters (or combinations of them):

  • Comma (, )
  • Semicolon (; )
  • Space
  • Line breaks

Examples:

Comma-separated: 12, 15, 21

Space-separated: 12 15 21

Comma and space-separated: 30, 18 42, 60

Comma, semicolon, and space-separated: 24 36, 60; 100 120; 150, 200