Logo

MonoCalc

/

Coprime Checker

Math

Try:

Coprime verdict

35 and 48 are coprime

Coprime

GCD(35, 48)

1

Shared prime factors

none

No prime divides both numbers.

No common factor
The greatest common divisor of 35 and 48 is 1, so the two numbers are coprime — their only common positive divisor is 1.

Prime factorization

35 =

5 × 7

48 =

2⁴ × 3

About This Tool

Coprime Checker – Test Whether Numbers Are Relatively Prime

Two integers are coprime — also called relatively prime or mutually prime — when their greatest common divisor is exactly 1. In symbols, gcd(a, b) = 1, meaning the numbers share no positive factor other than 1. This checker tests two or more integers, reports the GCD it used to decide, shows the prime factorization of each value, and can even list every number coprime to a given N or find the nearest coprime to a target. It is a fast way to answer a question that appears everywhere from fraction arithmetic to cryptography.

How the Check Works

The engine behind every mode is the Euclidean algorithm, one of the oldest algorithms still in daily use. It repeatedly replaces the larger number with the remainder of dividing it by the smaller one — gcd(a, b) = gcd(b, a mod b) — until the remainder reaches zero. The last non-zero value is the GCD. Because the numbers shrink quickly, even twelve-digit inputs settle in a handful of steps. If that GCD comes out as 1, the numbers are coprime; anything larger is a factor they share, and the checker highlights it.

Pairwise Versus Setwise Coprime

With three or more numbers there are two different questions to ask. A set is pairwise coprime when every possible pair has a GCD of 1, and setwise coprime when only the GCD of the whole collection is 1. Pairwise is the stronger condition and always implies setwise, but not the reverse. The set {6, 10, 15} is the textbook example: no pair inside it is coprime — 6 and 10 share 2, 6 and 15 share 3, 10 and 15 share 5 — yet the overall GCD is 1, so the set is setwise coprime without being pairwise coprime. The multi-number mode draws a colour-coded matrix so you can spot exactly which pairs clash.

Two even numbers are never coprime
Any pair of even numbers both divide by 2, so their GCD is at least 2. The same holds for any shared prime: once two numbers have a common prime factor, coprimality is impossible. Comparing prime factorizations is a quick sanity check on the GCD result.

Prime Factorization and Shared Factors

Coprimality is really a statement about prime factors: two numbers are coprime precisely when their factorizations have no prime in common. The checker factorizes each input by trial division and displays the result in tidy exponent form, such as 48 = 2⁴ × 3 and 35 = 5 × 7. Because those two share no prime, they are coprime. When they are not, the tool names the offending primes directly, which makes the verdict easy to verify by hand.

Range Lists and Nearest Coprime

The range mode lists every integer in an interval that is coprime with a chosen N. Counting those values is closely tied to Euler's totient function φ(N), which gives the number of integers from 1 to N that are coprime with it; the tool reports the coprime density as an estimate of φ(N)/N. The nearest-coprime mode starts at a target value and steps outward until it lands on a number coprime with the reference — handy when you need a value close to a preferred figure but free of shared factors, as when picking an RSA public exponent.

Where Coprimality Matters

A fraction is in lowest terms exactly when its numerator and denominator are coprime, so this test underlies every fraction simplifier. In RSA cryptographythe public exponent must be coprime with Euler's totient of the modulus for a valid modular inverse to exist. Engineers deliberately choose coprime gear-tooth counts so that the same pair of teeth rarely meets twice, spreading wear evenly. Calendar and scheduling cycles with coprime periods realign only after the product of their lengths, which is why coprime numbers keep repeating patterns from lining up too soon.

Reading the Output and Limits

Every mode gives a clear coprime-or-not banner, the GCD, and an explanation you can copy, download as text or CSV, or share through a link that restores your inputs. Values may be as large as 10¹², the multi-number list is capped at twenty entries to keep the pairwise matrix legible, and the range sweep is limited to ten thousand values. Zero is rejected because gcd(0, n) = n makes a coprime verdict meaningless, and negative inputs are allowed only when you enable them, in which case the check uses absolute values.

Frequently Asked Questions

Is the Coprime Checker free?

Yes, Coprime Checker is totally free :)

Can I use the Coprime Checker offline?

Yes, you can install the webapp as PWA.

Is it safe to use Coprime Checker?

Yes, any data related to Coprime Checker only stored in your browser (if storage required). You can simply clear browser cache to clear all the stored data. We do not store any data on server.

How does this coprime checker work?

It runs the Euclidean algorithm to find the greatest common divisor (GCD) of the numbers you enter. Two integers are coprime exactly when their GCD equals 1, meaning they share no common factor other than 1. The tool shows the GCD it computed, the prime factorization of each number, and the step-by-step division chain so you can see how the verdict was reached.

What is the difference between pairwise and setwise coprime?

For three or more numbers, pairwise coprime means every pair among them has a GCD of 1, while setwise coprime means only the GCD of the entire set is 1. Pairwise always implies setwise, but not the other way around. The classic example is 6, 10 and 15: no pair is coprime (6 and 10 share 2, 6 and 15 share 3, 10 and 15 share 5), yet the overall GCD is 1, so the set is setwise coprime but not pairwise coprime.

Can two even numbers ever be coprime?

No. Any two even numbers share the factor 2, so their GCD is at least 2 and they can never be coprime. More generally, if two numbers share any prime factor they are not coprime. This is why 8 and 12 are not coprime (both divisible by 2 and 4) while 8 and 15 are (they share no prime).

Does the sign of a number affect whether it is coprime?

No. Coprimality depends only on the magnitude of a number, so the GCD is computed from absolute values and a minus sign never changes the result. For example, -8 and 15 are coprime just as 8 and 15 are. Negative inputs are accepted only when you enable the negative-integers option, and zero is never allowed because gcd(0, n) equals n.

Why is coprimality useful in real life?

Coprimality underpins fraction simplification (a fraction is in lowest terms when its numerator and denominator are coprime), RSA cryptography (the public exponent must be coprime with Euler's totient of the modulus), and mechanical design (choosing coprime gear-tooth counts spreads wear evenly). It also governs cycle and scheduling problems, where two events with coprime periods realign only after their product of steps.

How large can the numbers be?

Each value can be as large as 1,000,000,000,000 (10^12). The GCD itself is found almost instantly by the Euclidean algorithm, and the prime factorization used for the display is computed by trial division up to the square root, which stays fast within this limit. The multi-number list is capped at 20 entries and the range lister at 10,000 values to keep the results readable and responsive.