Relatively Prime Calculator
Our relatively prime calculator will help you determine whether two numbers are relatively prime. Don't fret if this is your first time hearing the terms "relatively prime" or "coprime numbers." In the following article, we shall go through the fundamentals on this topic, including:
- Definition of relatively prime numbers.
- How to check whether two numbers are coprime?
- How to calculate relatively prime numbers?
- Coprimes in a set of numbers.
You would benefit from learning about prime numbers before learning about coprime numbers. Our prime number calculator will help.
Definition of relatively prime numbers
Relatively prime numbers are a pair of natural numbers with only 1 as the common factor between them. This means that any number that can divide one number cannot divide the other. We also call such pairs coprime or mutually prime numbers.
If a and b are coprime, we can say that:
- a is prime to b; or
- a is coprime with b.
Relatively prime numbers need not be prime numbers! For example, consider the numbers 14 and 15. Both of them are composite numbers:
- . .
- . .
But the only common factor between 14 and 15 is 1. Hence, 14 is prime to 15.
Need help with prime factorization? Use our very popular prime factorization calculator!
🙋 Since 1 is the only common factor of coprime numbers, their greatest common factor is 1. Learn more about the GCF of two numbers with our GCF calculator.
How to check whether two numbers are relatively prime
To check whether two given numbers are coprime, follow these steps:
- Prime factorize the two numbers.
- Find any common factors between the two.
- The numbers are coprime if there are no prime common factors between the two (i.e., if 1 is the only common factor). If there are other common factors, then the numbers are not coprime.
For example, look at the numbers 14 and 27:
- .
- .
Since there are no common prime factors, they are coprime. Thus we say 12 is prime to 27.
Now, take the numbers 18 and 27:
- .
- .
Since 3 is a common prime factor between 18 and 27, they are not coprime.
Let's learn how to calculate coprime numbers for a given number in the next section.
How do you calculate relatively prime numbers?
To calculate a relatively prime number for a given number a
, follow these steps:
- Prime factorize
a
to get all of its prime factors. - Find any prime number that is not a prime factor of
a
. That prime number will be a relatively prime witha
. - Alternatively, find any natural number that does not share a common prime factor with
a
. That number will be relatively prime witha
.
For example, consider the number 45. Its prime factors are: .
-
Since is a prime number that is not a prime factor of 45, we can conclude that 2 and 45 are relatively prime.
-
We could also find other natural numbers like that do not share any common prime factors with 45. Thus, 14 and 45 are relatively prime.
Coprimes in sets
We say that a set of integers is relatively prime or setwise coprime if their greatest common factor is 1. For example, the set of numbers {4, 6, 21} is setwise coprime, since the GCF(4, 6, 21) = 1.
If every pair of integers in the set are coprime, then we say the set is pairwise coprime. In the above example, the set {4, 6, 21} is setwise coprime, but not pairwise coprime, since the pair (4,6) is not coprime. Now consider the set {4, 7, 27}. In this set, every pair of integers are coprime too! Hence, the set {4, 7, 27} is pairwise coprime!
Using our relatively prime calculator
Our coprime calculator is easy to use:
-
Want to determine whether two numbers are coprime or not?
-
In the Check for field, choose the option a pair of numbers.
-
Enter the numbers in the fields labeled
#1
and#2
, and our calculator will give you the result immediately.
-
-
Do you want to know whether a set of numbers are setwise coprime?
-
In the Check for field, choose the option a set of numbers.
-
Enter the numbers in the fields labeled
#1
,#2
, etc. You can enter up to ten numbers! -
Once you input three or more numbers, the calculator will tell you whether the set of numbers is relatively prime, pairwise coprime, or not coprime at all.
-
FAQ
Are the numbers 42 and 75 relatively prime?
The numbers 42 and 75 are NOT relatively prime. To figure this out yourself, follow these steps:
-
Factorize 42 to get its prime factors:
42 = 2 × 3 × 7
-
Factorize 75 for its prime factors:
75 = 3 × 5 × 5
-
Notice that 42 and 75 share
3
as a common prime factor. Hence, they cannot be coprime. -
You can verify your result with an online relatively prime calculator.
Can two even numbers be coprime?
No, since all even numbers share 2
as their common factor, they cannot be relatively prime. At least one number has to be odd for a pair (or a set) of numbers to be coprime.
Is 1 relatively prime to any number?
Yes, 1 is relatively prime to every number. This is because the only common factor between 1 and any other number is 1, as required in the definition of relatively prime numbers.