Beginner

Relatively Prime Calculator — Coprime Checker

Enter two positive integers to find out whether they are relatively prime (coprime) — meaning their only common factor is 1 — with the full Euclidean algorithm shown step by step.
Positive whole number
Positive whole number
Are they relatively prime (coprime)?
Yes — Coprime ✓
GCD (Greatest Common Divisor)
1
LCM (Least Common Multiple)
420
Shared factors
None — only 1 divides both
04.69.313.918.523.127.832.437a = 35b = 12a and b on the number line — GCD = 1 (coprime)
Euclidean algorithm — step by step
1

Divide 35 by 12

35 = 12 × 2 + 11 → remainder 11
2

Divide 12 by 11

12 = 11 × 1 + 1 → remainder 1
3

Divide 11 by 1

11 = 1 × 11 + 0 → remainder 0
=

Remainder is 0 — GCD = 1, so the numbers are relatively prime

GCD(35, 12) = 1
Results are estimates for general information only and are not professional advice — always verify important results independently before relying on them. Read the full disclaimer.
Quick answer

How does this calculator work?

Two integers are coprime (relatively prime) if and only if their GCD equals 1. Use the Euclidean algorithm: repeatedly replace (a, b) with (b, a mod b) until b = 0; the last non-zero value is the GCD. If GCD = 1, the numbers are coprime and share no prime factors.

Formula
GCD(a, b) via Euclidean algorithm; a and b are coprime if and only if GCD(a, b) = 1
How this is calculated

Two integers are called relatively prime (or coprime) if the only positive integer that divides both of them is 1 — in other words, their Greatest Common Divisor (GCD) equals 1. This is a key property in number theory and is used throughout mathematics: a fraction is in lowest terms when its numerator and denominator are coprime; RSA encryption relies on picking two large coprime numbers; and the Chinese Remainder Theorem applies precisely when moduli are pairwise coprime.

This calculator uses the Euclidean algorithm to find the GCD. It works by repeatedly replacing the pair (a, b) with (b, a mod b) because any common divisor of a and b also divides the remainder a mod b. When the remainder reaches 0, the last non-zero value is the GCD. If that value is 1, the numbers are coprime; if it is greater than 1, they share at least one prime factor.

The algorithm is guaranteed to terminate because remainders strictly decrease, and it runs in O(log min(a, b)) steps — extremely efficient even for very large numbers. The Least Common Multiple (LCM) is also shown using the identity LCM(a, b) = (a × b) / GCD(a, b).

Frequently asked questions

Two integers are relatively prime (coprime) when they share no common factor greater than 1. For example, 35 and 12 are coprime because 35 = 5 × 7 and 12 = 2² × 3 share no prime factors. Note: neither number needs to be prime itself — "relatively prime" is a relationship between two numbers, not a property of a single number.

Yes. The integer 1 has no prime factors, so GCD(1, n) = 1 for every positive integer n. This means 1 is coprime to every positive integer.

The Euclidean algorithm finds GCD(a, b) by repeatedly computing remainders: replace (a, b) with (b, a mod b) until b = 0; at that point a is the GCD. It is one of the oldest algorithms in mathematics, described by Euclid around 300 BC, and remains the fastest general method for computing the GCD.

Also known as

coprime calculator
are two numbers coprime
relatively prime numbers
gcd equals 1 checker
coprime integers tool
euclidean algorithm coprime
shared factors checker

APA

TG we-Calculate Editorial Team. (2026). Relatively Prime Calculator — Coprime Checker [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/relatively-prime-calculator

Chicago

TG we-Calculate Editorial Team. "Relatively Prime Calculator — Coprime Checker." TG we-Calculate. 2026. https://we-calculate.com/calculator/relatively-prime-calculator.

IEEE

TG we-Calculate Editorial Team, "Relatively Prime Calculator — Coprime Checker," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/relatively-prime-calculator

BibTeX

@misc{wecalculate_relatively_prime_calculator, title = {Relatively Prime Calculator — Coprime Checker}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/relatively-prime-calculator}}, year = {2026}, note = {TG we-Calculate} }

Did this calculator help you?