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
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.
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:
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 number | Second number | GCD | LCM | Relatively prime? |
|---|---|---|---|---|
| 12 | 25 | 1 | 300 | Yes |
| 18 | 24 | 6 | 72 | No |
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.