Relatively Prime Calculator

Calculate the greatest common divisor, least common multiple, and coprimality status based on two provided integers. Relatively Prime Calculator helps students, teachers, programmers, and mathematicians analyze number relationships and solve arithmetic problems.

Highlights

  • Check whether two integers are relatively prime.
  • Calculate the greatest common divisor (GCD).
  • Find the least common multiple (LCM).
  • Analyze shared factors between two positive integers.
  • Supports numbers ranging from 1 to 1 trillion.

Table of Contents

  1. How Relatively Prime Calculator Works?
  2. Practical Use Cases
  3. Accuracy and Limitations
  4. Quick Examples
  5. Frequently Asked Questions (FAQs)
  6. Cite This Calculator

How Relatively Prime Calculator Works?

The Relatively Prime Calculator compares two positive integers to find their greatest common divisor (GCD), least common multiple (LCM), and coprimality status. The greatest common divisor is the largest positive integer that divides both numbers without a remainder. The calculator can determine it efficiently using the Euclidean algorithm, which repeatedly replaces the larger number with the remainder from dividing the larger number by the smaller number until the remainder is zero.

gcd(a,b)=gcd(b,a mod b)

The least common multiple is the smallest positive integer divisible by both inputs. Once the GCD is known, the LCM is calculated with the relationship below:

lcm(a,b)=a⁢bgcd(a,b)

Two numbers are relatively prime, or coprime, when their only common positive factor is 1. Therefore, the calculator reports that the numbers are relatively prime exactly when their GCD equals 1.


First numberSecond numberGCDLCMRelatively prime?
12251300Yes
1824672No

For example, 12 and 25 have no common factor greater than 1, so their GCD is 1 and they are relatively prime. Their LCM is 12 × 25 = 300.

Practical Use Cases

Students can use the calculator to check homework involving factors, multiples, prime relationships, fraction simplification, and number theory. For example, entering 12 and 25 shows a GCD of 1, an LCM of 300, and a relatively prime result.

Teachers can use it to create or verify examples for lessons on the Euclidean algorithm, common factors, common multiples, and coprime numbers. Comparing 18 and 24 demonstrates that a GCD of 6 means the numbers are not relatively prime.

Programmers can use the results when testing algorithms involving divisibility, scheduling cycles, modular arithmetic, and rational-number operations. The GCD helps reduce fractions, while the LCM can identify when repeating integer-based processes coincide.

Mathematicians can use the calculator to quickly examine divisibility relationships and test whether pairs of integers satisfy coprimality conditions in problems involving prime factors, congruences, or combinatorics.

Accuracy and Limitations

The calculator provides mathematically exact GCD, LCM, and coprimality results for integer inputs from 1 through 1,000,000,000,000. It accepts only positive whole numbers, so zero, negative values, decimals, and values outside the specified range are not supported. The LCM can be much larger than either input—for example, two values near the maximum may produce an LCM near 1024—so the displayed result must support sufficiently large integer values to avoid overflow or rounding in implementations that use limited-precision numeric types.

Quick Examples

Example #1: Relatively Prime Numbers

Check two numbers that share no common factor other than 1.

Example #2: Numbers with Common Factors

Calculate the greatest common divisor and least common multiple for two related numbers.

Example #3: Large Integer Comparison

Analyze the shared factors and coprimality of two larger integers.

Frequently Asked Questions

Two numbers are relatively prime when their greatest common divisor is 1. They do not need to be prime numbers themselves.

Two even numbers cannot be relatively prime because both are divisible by 2. However, an even number and an odd number may be relatively prime.

The greatest common divisor is the largest number that divides both values evenly. The least common multiple is the smallest positive number that both values divide evenly.

Find their greatest common divisor. If it equals 1, the numbers are relatively prime; otherwise, they share a common factor greater than 1.

For positive integers, the product of the greatest common divisor and least common multiple equals the product of the two numbers. In symbols, GCD(a, b) × LCM(a, b) = a × b.

Cite This Calculator