Understanding Relatively Prime Numbers

Two integers are relatively prime if their greatest common divisor (GCD) equals 1. Crucially, relatively prime numbers need not be prime themselves. For instance, 14 and 15 are both composite: 14 = 2 × 7 with factors {1, 2, 7, 14}, and 15 = 3 × 5 with factors {1, 3, 5, 15}. Their only shared factor is 1, making them coprime.

The terminology reflects this relationship: if a and b are coprime, we say a is prime to b. This differs from saying a is a prime number, which has a different meaning entirely.

Checking Pairwise and Setwise Coprimality

When examining multiple numbers, two distinct concepts apply:

  • Setwise coprime: A set has GCD equal to 1. For example, {4, 6, 21} is setwise coprime because GCD(4, 6, 21) = 1, even though 4 and 6 share the factor 2.
  • Pairwise coprime: Every possible pair within the set is coprime. The set {4, 7, 27} satisfies this: (4,7), (4,27), and (7,27) are all coprime pairs.

Pairwise coprimality is the stricter condition and implies setwise coprimality.

Testing Coprimality

The primary method involves prime factorization. Factorize each number completely, then inspect their prime factor lists. If no prime factor appears in more than one number, they are coprime.

GCD(a, b) = 1 ⟺ a and b are coprime

  • a, b — Two integers to test for coprimality
  • GCD(a, b) — Greatest common divisor; equals 1 for coprime numbers

Practical Example: Testing 42 and 75

Factorize 42: 42 = 2 × 3 × 7

Factorize 75: 75 = 3 × 5²

Both share the prime factor 3, so their GCD is at least 3. Therefore, 42 and 75 are not relatively prime. This method scales to any number of integers: if all prime factors appear in only one number, the set is coprime.

Common Pitfalls and Key Facts

Avoid these misconceptions when working with coprime numbers:

  1. Even numbers cannot be pairwise coprime — All even numbers share 2 as a factor. For a pair to be coprime, at least one must be odd. Sets like {2, 4, 8} are not coprime because every element is divisible by 2.
  2. 1 is coprime with everything — The number 1 has only itself as a factor. By definition, GCD(1, n) = 1 for any positive integer n, making 1 coprime with all other integers.
  3. Composite numbers can be coprime — Coprimality is about shared factors, not primality. Two composite numbers like 9 and 25 (both non-prime) are coprime because they share no prime factors.
  4. Setwise and pairwise coprimality differ — A set can be setwise coprime without being pairwise coprime. Always clarify which type you need: do all pairs require GCD = 1, or just the entire set?

Frequently Asked Questions

How do I determine if two numbers are coprime?

Factorize both numbers completely into primes. Compare the prime factor lists. If they share no common prime factors, the numbers are coprime (GCD = 1). For example, 8 = 2³ and 35 = 5 × 7 share no primes, so they are coprime. Conversely, 12 = 2² × 3 and 18 = 2 × 3² both contain 2 and 3, so they are not coprime.

Are 42 and 75 relatively prime?

No. Factorizing: 42 = 2 × 3 × 7 and 75 = 3 × 5². Both contain 3 as a prime factor, so GCD(42, 75) = 3 ≠ 1. They share a common divisor, disqualifying them from being coprime. Testing all candidate divisors would confirm that 3 divides both.

Can two even numbers ever be coprime?

No, never. All even numbers are divisible by 2, so any pair of even numbers automatically shares 2 as a common factor. For a pair to be relatively prime, their GCD must equal 1. At least one number must be odd to satisfy this requirement.

What does it mean for a set of numbers to be pairwise coprime?

Pairwise coprimality means every possible pair within the set is coprime. For {3, 5, 7}, check: GCD(3,5) = 1, GCD(3,7) = 1, and GCD(5,7) = 1. All pairs work, so the set is pairwise coprime. This is stricter than setwise coprimality, which only requires the GCD of all numbers together to be 1.

Is 1 coprime with all other numbers?

Yes. The number 1 has no prime factors, and every other positive integer's only common factor with 1 is 1 itself. Therefore, GCD(1, n) = 1 for any integer n ≥ 1, making 1 coprime by definition with every positive integer.

How many numbers can this calculator handle?

The calculator accepts up to 10 numbers simultaneously. You can enter individual integers in the input fields and select whether you want to check for pairwise coprimality (stricter, requires all pairs to be coprime) or setwise coprimality (looser, requires only the overall GCD to equal 1).

More math calculators (see all)