Coprime Checker

gcd(a,b) = 1?

CalculatorsFreeNo Signup
4.5(866 reviews)
All Tools

Loading tool...

About Coprime Checker

A coprime checker testing if gcd(a,b) = 1. Shows extended GCD, Bézout coefficients (ax+by=gcd), counts coprimes up to n via Euler's totient, and checks pairwise coprimality for sets. All calculations are client-side.

Coprime Checker Features

  • Coprime check
  • GCD
  • Bézout
  • Totient count
  • Set check
Coprime (relatively prime): gcd(a,b)=1. Examples: gcd(8,15)=1 ✓, gcd(12,18)=6 ✗. Bézout's identity: ax+by=gcd(a,b) always has integer solutions. Probability that two random integers are coprime: 6/π² ≈ 61%.

How to Use

Enter a and b:

  • Coprime: Is gcd(a,b)=1?
  • Bézout: Find x,y with ax+by=gcd
  • Count: Coprimes up to n

Bézout's Identity

For any a,b: ∃x,y ∈ Z with ax+by=gcd(a,b). Found by extended Euclidean algorithm. When gcd=1: ax+by=1, so x=a⁻¹ (mod b). This is the basis of modular arithmetic.

Coprimality Probability

P(gcd(a,b)=1) = 6/π² = 1/ζ(2) ≈ 0.6079. For k numbers: P(gcd=1) = 1/ζ(k). This connects number theory to the Riemann zeta function.

Step-by-Step Instructions

  1. 1Enter a.
  2. 2Enter b.
  3. 3Check coprime.
  4. 4View Bézout.
  5. 5Count coprimes.

Coprime Checker — Frequently Asked Questions

Why is 6/π² the probability?+

Two numbers are coprime iff no prime divides both. P(p∤both) = 1−1/p². Over all primes: Π(1−1/p²) = 1/Σ(1/n²) = 1/ζ(2) = 6/π² ≈ 61%. This surprising connection to π was discovered by Euler.

What is pairwise coprimality?+

A set {a₁,...,aₖ} is pairwise coprime if gcd(aᵢ,aⱼ)=1 for all i≠j. This is stronger than gcd(a₁,...,aₖ)=1. Example: {6,10,15} has gcd=1 but gcd(6,10)=2, so not pairwise coprime.

How does coprimality relate to modular inverses?+

a has a modular inverse mod n iff gcd(a,n)=1. The inverse is the Bézout coefficient: if ax+ny=1, then a⁻¹≡x (mod n). This is why only coprimes to n form the multiplicative group (Z/nZ)*.

Share this tool: