Relatively Prime Calculator & Coprime Checker
Welcome to your go-to resource for number theory. The concept of coprimality is vital. It connects computer security, engineering, and music. It seems simple: do two numbers share a divisor? But the answer changes how we secure the internet and build machines.
This guide explains the “why” behind the math. We go beyond simple “yes or no” answers. We look at the algorithms and logic used by experts. This tool is part of the My Online Calculators suite. We design our tools to educate, not just compute.
By the end, you will know how to determine if two numbers are coprime. You will also understand Euler’s Totient function and the Euclidean Algorithm.
What is the Relatively Prime Calculator?
The relatively prime calculator analyzes two or more integers. It looks for common factors. Standard calculators add or multiply. This tool checks the properties of the numbers.
Two integers are relatively prime (or coprime) if their only common divisor is 1. They have no other shared building blocks. This tool automates the math. It finds the Greatest Common Divisor (GCD) instantly.
How to Use Our Coprime Checker Online
We designed this coprime checker online for speed and ease. It works for students and professionals. Follow these steps:
- Find the Inputs: Look for “Number A” and “Number B” at the top.
- Enter Integers: Type the two whole numbers you want to check.
- Example: Try
14and15. They are not prime numbers, but they are coprime to each other.
- Example: Try
- Add More Numbers: Do you have a set of three? Click “Add Number” to check more digits.
- Click Calculate: Hit the blue button.
- Read the Result:
- Status: It will say “COPRIME” (Green) or “NOT COPRIME” (Red).
- GCD: It shows the Greatest Common Factor. If the GCD is 1, they are coprime.
- Factors: You will see the factors listed. This proves the result.
Coprime Formula Explained
How does the math work? The definition relies on the greatest common divisor and coprimality.
Integers a and b are relatively prime if:
GCD(a, b) = 1Every number is made of prime factors. These are like atoms. To check for coprimality, we compare the atoms. You can visualize this using a prime factorization tool.
Example 1: 12 and 35
- Factors of 12: {1, 2, 3, 4, 6, 12}
- Factors of 35: {1, 5, 7, 35}
The only number on both lists is 1. They are coprime.
Example 2: 12 and 15
- Factors of 12: {1, 2, 3, 6, 12}
- Factors of 15: {1, 3, 5, 15}
They share 1 and 3. The GCD is 3. They are not relatively prime.
Everything About Coprime Numbers
Most articles stop at the basics. We will go deeper. This section covers the expert concepts you need to know.
1. Mutually Prime Numbers Examples
When you check three numbers, it gets tricky. There is a difference between “Mutually Prime” and “Pairwise Prime.”
Mutually Prime (Set-wise): The numbers share no common factor across all three.
- Set: {6, 10, 15}
- 6 is divisible by 2 and 3.
- 10 is divisible by 2 and 5.
- 15 is divisible by 3 and 5.
No single number divides all three. They are mutually prime.
Pairwise Prime: Every pair must be coprime. In the set above, 6 and 10 share a 2. They fail this test. Pairwise prime is a much stricter standard.
2. Relatively Prime vs Prime Numbers
This is a common mistake. “Prime” applies to one number. “Relatively Prime” applies to the relationship between two numbers.
Yes. Look at 25 and 26. Neither is prime. 25 is $5 \times 5$. 26 is $2 \times 13$. They share no factors. They are relatively prime.
3. Euclidean Algorithm for Coprime Numbers
Computers do not list factors for huge numbers. It takes too long. Instead, they use the Euclidean Algorithm for coprime numbers. It is fast and efficient.
The Logic: If a number divides both A and B, it also divides (A – B).
- Divide A by B. Get the remainder.
- Swap the numbers. Divide B by the remainder.
- Repeat until the remainder is 0.
- The last non-zero remainder is the GCD.
If that final result is 1, your numbers are coprime.
4. Euler’s Totient Function Explanation
In cryptography, we count coprimes. We use Euler’s Totient Function, written as $\phi(n)$. It counts how many integers below $n$ are coprime to $n$.
For a prime number $p$, the answer is easy: $p – 1$. For two primes multiplied together, it helps create encryption keys.
Real-World Applications
Why does this matter? It is not just for homework. It builds our world.
RSA Cryptography Relatively Prime Numbers
RSA cryptography relatively prime numbers protect your data. When you create a digital key, you pick a public exponent. This number must be relatively prime to the totient of your modulus. If it isn’t, the math breaks. You cannot decrypt the message. Coprimality is the gatekeeper of security.
Coprimality in Gear Ratios and Music Theory
Engineers use this for gears. Imagine a 13-tooth gear and a 41-tooth gear. They are coprime. This means every tooth on the small gear hits every tooth on the big gear before repeating. This spreads out wear and tear. It prevents damage.
In music, coprimality in gear ratios and music theory creates polyrhythms. A 5:4 rhythm is coprime. The beats do not align for a long time. This creates tension and complex patterns in jazz and classical music.
Frequently Asked Questions
How do I determine if two numbers are coprime quickly?
Use heuristics. Consecutive numbers (like 20 and 21) are always coprime. Two different prime numbers are always coprime.
Is 1 relatively prime to everything?
Yes. The GCD of 1 and any number is 1. Therefore, 1 is coprime to all integers.
Can two even numbers be coprime?
No. Even numbers are both divisible by 2. Their GCD is at least 2. They cannot be coprime.
What are mutually prime numbers examples?
A set like {3, 7, 11} is mutually prime. Actually, this set is also pairwise prime because no two numbers share a factor.
Ready to check your numbers? Scroll to the top and use the Relatively Prime Calculator now!
