Coprime Numbers Calculator
Check whether two to four whole numbers are coprime (relatively prime). Finds the greatest common divisor (GCD); numbers are coprime when the GCD is 1.
Coprime Numbers Calculator
Enter two to four whole numbers to check whether they are coprime. The tool finds their greatest common divisor (GCD); the numbers are coprime when the GCD is 1.
Enter 2 to 4 positive whole numbers.
How this was calculated
The greatest common divisor of 8, 15 is 1. Numbers are coprime when their GCD is 1.
Documentation
Coprime numbers are two or more whole numbers whose only common positive divisor is 1. This calculator checks whether the numbers you enter are coprime by finding their greatest common divisor (GCD). If the GCD is 1, the numbers are coprime.
Coprime numbers are also called relatively prime or mutually prime numbers.
What does coprime mean?
Two whole numbers are coprime when no whole number larger than 1 divides both of them. The numbers themselves do not have to be prime. For example, 8 and 15 are coprime: the factors of 8 are 1, 2, 4, and 8, while the factors of 15 are 1, 3, 5, and 15. The only factor they share is 1, so they are coprime.
By contrast, 12 and 18 are not coprime. Both can be divided by 2, 3, and 6, so their greatest common divisor is 6.
How to check if numbers are coprime
- Find the greatest common divisor (GCD) of all the numbers. The GCD is the largest whole number that divides every number with no remainder.
- Compare the GCD to 1. If the GCD equals 1, the numbers are coprime. If the GCD is greater than 1, they are not coprime.
The GCD of a group of numbers is found by applying the Euclidean algorithm to two numbers at a time: the GCD of three numbers a, b, and c is GCD(GCD(a, b), c).
Coprime formula
Numbers a₁, a₂, …, aₙ are coprime when:
GCD(a₁, a₂, …, aₙ) = 1
Example
Check whether 6, 10, and 15 are coprime.
- GCD(6, 10) = 2
- GCD(2, 15) = 1
The greatest common divisor of all three numbers is 1, so 6, 10, and 15 are coprime as a set.
Note that these three numbers are not pairwise coprime. 6 and 10 share the factor 2, 6 and 15 share the factor 3, and 10 and 15 share the factor 5. Set coprimality (the GCD of every number together is 1) is a weaker condition than pairwise coprimality (every pair has a GCD of 1). This calculator reports both.
Pairwise coprime vs. setwise coprime
A group of numbers is setwise coprime when the GCD of the whole group is 1. It is pairwise coprime when every possible pair within the group has a GCD of 1. Pairwise coprime numbers are always setwise coprime, but the reverse is not always true, as the example above shows.
Frequently asked questions
Are 1 and any number coprime?
Yes. The number 1 shares no factor larger than 1 with any whole number, so 1 is coprime with every whole number, including itself.
Do coprime numbers have to be prime?
No. Coprime numbers can be composite. 8 and 15 are both composite, yet they are coprime because they share no common factor other than 1.
Are two different prime numbers always coprime?
Yes. Two distinct prime numbers have no common factor except 1, so any two different primes are coprime.
Can negative numbers be coprime?
Coprimality is usually defined for positive whole numbers. This calculator accepts positive whole numbers of 1 or greater.
What is the difference between GCD and coprime?
The GCD is the largest number that divides all the inputs. "Coprime" is the specific case when that GCD equals 1.