# The greatest common divisor of two integers

This calculator determines the greatest common divisor of two integers using Euclidean algorithm

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/323/. Also, please do not modify any references to the original work (if any) contained in this content.

The greatest common divisor of two integers, m and n, is the largest integer that divides them both.

This calculator determines the greatest common divisor of two integers using the Euclidean algorithm.

The euclidean algorithm is straightforward.

You start building a sequence of numbers. The first one is the greatest of two integers; the second is the opposite; the third is the remainder of the division of two previous numbers; the fourth is the remainder of the division of the second and third one, etc. The last remainder before zero is the answer.

I'll show by example.

Suppose we need to find GCD for 13 and 17

1 step. Create initial sequence

**17, 13**

2 step. The third member is the remainder of the division of 17 to 13

**17, 13, 4**

3 step. The fourth member is the remainder of the division of 13 to 4

**17, 13, 4, 1**

4 step. The fifth member is the remainder of the division of 4 to 1

**17, 13, 4, 1, 0**

1 is the last remainder before 0, so this is our answer.

And numbers those GCD is 1 are called **prime numbers**

#### Similar calculators

- • The greatest common divisor and the least common multiple of two integers
- • Extended Euclidean algorithm
- • The Greatest Common Divisor (GCD) and the Least Common Multiple (LCM) of several numbers
- • The Greatest Common Factor of several numbers
- • Polynomial Greatest Common Divisor
- • Math section ( 301 calculators )

**

**PLANETCALC, The greatest common divisor of two integers

## Comments