Relatively Prime Calculator

Enter two integers to check if they are coprime, with full Euclidean algorithm steps.

๐Ÿ”— Relatively Prime Calculator
First Number
Second Number
GCF (Greatest Common Factor)
Relatively Prime?
Common Divisors
Prime Factorizations
All Common Divisors
Euclidean Algorithm Steps

๐Ÿ”— What is a Relatively Prime Calculator?

Relatively prime numbers (also called coprime or mutually prime numbers) are two integers that share no common factor other than 1. In formal terms, two integers a and b are relatively prime when their greatest common factor (GCF, also written GCD) equals exactly 1. The numbers themselves do not need to be prime. Composite numbers can still be coprime with each other if their prime factorizations do not overlap at all.

This calculator accepts any two positive integers, computes their GCF using the Euclidean algorithm, and immediately states whether the pair is coprime. It also shows the full step-by-step Euclidean algorithm working, the prime factorization of each number in exponent notation, and a complete list of every divisor the two numbers share. For coprime inputs the list of common divisors is simply {1}.

Coprimality appears across a wide range of contexts. In elementary arithmetic it determines whether a fraction is already in lowest terms: a/b is fully reduced when GCF(a, b) = 1. In scheduling problems, two periodic events that repeat every a and b units will next coincide after exactly a times b time units (rather than fewer) when a and b are coprime. In number theory and abstract algebra, coprimality underlies the Chinese Remainder Theorem, Euler's totient function, and modular inverses. In cryptography, RSA requires the public exponent to be coprime with the totient of the modulus so that a unique decryption exponent exists.

A common source of confusion is the difference between a number being prime and two numbers being coprime. Primality is a property of one number (it has no divisors other than 1 and itself). Coprimality is a relationship between two numbers (their GCF is 1). Composite numbers can be coprime: 8 and 9 are both composite but coprime because they share no prime factor. Conversely, two prime numbers are always coprime with each other, but a prime is not coprime with its own multiples.

๐Ÿ“ Formula

a ⊥ b  ⇔  GCF(a, b) = 1
a, b = the two positive integers being tested
GCF(a, b) = greatest common factor, computed via the Euclidean algorithm
= notation for "is coprime with" (relatively prime)
Euclidean algorithm: GCF(a, b) = GCF(b, a mod b), repeated until remainder = 0
Example: GCF(14, 15): 15 = 1 × 14 + 1; 14 = 14 × 1 + 0. GCF = 1, so 14 and 15 are coprime.
Consequence: If GCF(a, b) = 1, then LCM(a, b) = a × b

๐Ÿ“– How to Use This Calculator

Steps

1
Enter the first integer - Type the first positive integer into the First Number field. Any positive integer up to 1 billion is accepted.
2
Enter the second integer - Type the second positive integer into the Second Number field.
3
Click Check - Press the Check button (or hit Enter) to run the Euclidean algorithm instantly.
4
Read the verdict and GCF - The top row shows the GCF, a clear Yes or No for relatively prime, and the count of common divisors.
5
Review the step-by-step working - The Euclidean algorithm steps, prime factorizations, and full list of common divisors are shown below the main result so you can follow every stage of the calculation.

๐Ÿ’ก Example Calculations

Example 1 - Two consecutive integers (14 and 15)

Are 14 and 15 relatively prime?

1
Apply the Euclidean algorithm: 15 = 1 × 14 + 1
2
14 = 14 × 1 + 0. Remainder is 0, so GCF = 1.
3
Prime factorizations: 14 = 2 × 7 and 15 = 3 × 5. No shared primes.
GCF = 1 ⇒ Yes, 14 and 15 are relatively prime.
Try this example →

Example 2 - Numbers that share a common factor (12 and 18)

Are 12 and 18 relatively prime?

1
Apply the Euclidean algorithm: 18 = 1 × 12 + 6
2
12 = 2 × 6 + 0. GCF = 6.
3
Prime factorizations: 12 = 22 × 3 and 18 = 2 × 32. Both share the primes 2 and 3, giving GCF = 6.
GCF = 6 ⇒ No, 12 and 18 are NOT relatively prime. Common divisors: 1, 2, 3, 6.
Try this example →

Example 3 - Two large composite numbers (35 and 64)

Are 35 and 64 relatively prime?

1
Prime factorizations: 35 = 5 × 7 and 64 = 26. No shared prime factors.
2
Euclidean algorithm: 64 = 1 × 35 + 29; 35 = 1 × 29 + 6; 29 = 4 × 6 + 5; 6 = 1 × 5 + 1; 5 = 5 × 1 + 0. GCF = 1.
GCF = 1 ⇒ Yes, 35 and 64 are relatively prime. LCM(35, 64) = 35 × 64 = 2,240.
Try this example →

Example 4 - A prime and a composite (7 and 49)

Are 7 and 49 relatively prime?

1
Prime factorizations: 7 = 7 and 49 = 72. Both contain the prime 7.
2
Euclidean algorithm: 49 = 7 × 7 + 0. GCF = 7.
GCF = 7 ⇒ No, 7 and 49 are NOT relatively prime. A prime p is not coprime with any of its multiples.
Try this example →

โ“ Frequently Asked Questions

What does relatively prime mean in mathematics?+
Two integers are relatively prime (also called coprime or mutually prime) when their greatest common factor (GCF) equals 1. This means they share no common prime factors. For example, 8 and 9 are relatively prime because 8 = 2 cubed and 9 = 3 squared, so they share no primes. Being relatively prime is a relationship between two numbers, not a property of either number alone. The number 1 is relatively prime to every positive integer.
How do you check if two numbers are relatively prime?+
Use the Euclidean algorithm to find the GCF. If the result is 1, the numbers are coprime. Steps: divide the larger by the smaller and take the remainder; replace the larger with the smaller and the smaller with the remainder; repeat until the remainder is 0. The last non-zero remainder is the GCF. Alternatively, write both prime factorizations and check if they share any prime. If no prime appears in both, GCF = 1 and the numbers are coprime.
Are all prime numbers relatively prime to each other?+
Yes, any two distinct prime numbers are always relatively prime. Since a prime p has no factors other than 1 and itself, two distinct primes share only the factor 1, giving GCF = 1. For example, GCF(7, 11) = 1. However, a prime is not relatively prime to its own multiples: GCF(7, 14) = 7, not 1, because 14 = 2 times 7 contains 7 as a factor.
What is the LCM of two relatively prime numbers?+
When GCF(a, b) = 1, the LCM equals the product: LCM(a, b) = a times b. This follows from the general identity LCM(a, b) = a times b divided by GCF(a, b). When the GCF is 1, dividing changes nothing. For example, GCF(8, 9) = 1, so LCM(8, 9) = 8 times 9 = 72. This is the most efficient way to compute LCM for coprime pairs.
Are consecutive integers always relatively prime?+
Yes, any two consecutive integers n and n+1 are always relatively prime. If a number d divided both n and n+1, it would also have to divide their difference (n+1) minus n = 1. The only positive integer that divides 1 is 1 itself, so GCF(n, n+1) = 1 for every positive integer n. Examples: GCF(99, 100) = 1, GCF(1000, 1001) = 1.
What is the difference between coprime and prime?+
A prime number has exactly two positive divisors (1 and itself). This is a property of a single number. Coprime (relatively prime) describes a relationship between two numbers: their GCF is 1. Composite numbers can be coprime: 8 = 2 cubed and 9 = 3 squared are both composite but coprime because they share no prime factors. Every pair of distinct primes is coprime, but primality and coprimality are separate concepts.
How is coprimality used in RSA encryption?+
RSA public-key encryption requires the public exponent e to be coprime with the totient phi(n) = (p-1)(q-1), where p and q are large primes. The coprimality condition GCF(e, phi(n)) = 1 guarantees that a modular inverse d exists such that e times d is congruent to 1 mod phi(n). This d is the private key. Without coprimality, the modular inverse does not exist and decryption becomes impossible, breaking the encryption scheme.
How do you use GCF to simplify a fraction?+
Divide both the numerator and denominator by their GCF to get the fully reduced fraction. For 18/24: GCF(18, 24) = 6, so divide both by 6 to get 3/4. The fraction is in lowest terms because GCF(3, 4) = 1, meaning 3 and 4 are relatively prime. A fraction a/b is fully simplified if and only if a and b are coprime. You can verify this using the Relatively Prime Calculator by entering the simplified numerator and denominator.
Can three or more numbers be mutually relatively prime?+
Yes. A set of integers is pairwise (mutually) relatively prime when every pair from the set has GCF = 1. For example, 6, 35, and 143 are pairwise coprime: GCF(6, 35) = 1, GCF(6, 143) = 1, and GCF(35, 143) = 1. This is a stronger condition than just requiring the GCF of the entire set to equal 1. The set {6, 10, 15} has overall GCF = 1 but is not pairwise coprime because GCF(6, 10) = 2.
What happens when I enter two equal numbers?+
When both inputs are the same number n, GCF(n, n) = n. Since n equals 1 only when the input is 1, the only equal pair that is relatively prime is (1, 1). For any n greater than 1, GCF(n, n) = n, so the pair is not coprime. The common divisors of n with itself are all divisors of n, and the Euclidean algorithm terminates in one step because n divided by n leaves remainder 0.
What is the Euler totient function and how does it relate to coprimality?+
Euler's totient function phi(n) counts how many integers from 1 to n are coprime with n. For a prime p, phi(p) = p minus 1 because every integer from 1 to p-1 is coprime with p. For n = 12: the integers coprime with 12 are 1, 5, 7, and 11, so phi(12) = 4. Euler's theorem states that a raised to phi(n) is congruent to 1 mod n whenever GCF(a, n) = 1. This underpins modular exponentiation in both number theory and modern cryptography.
Is 1 relatively prime to every number?+
Yes. GCF(1, n) = 1 for every positive integer n because 1 has no divisors other than 1 itself, so the greatest common divisor of 1 and any number is always 1. This makes 1 the universal coprime partner. It is also the only positive integer that is coprime with itself: GCF(1, 1) = 1, while GCF(n, n) = n for any n greater than 1.