Input two numbers to find out if they are relatively prime.
Two integers are considered relatively prime if their greatest common divisor (GCD) is 1. This means the numbers share no common factors other than 1. For example, (8, 15) and (9, 28) are pairs of relatively prime numbers.
Solution:
Factors of 35: 1, 5, 7, 35
Factors of 72: 1, 2, 3, 4, 6, 8, 9, 12, 18, 24, 36, 72
GCD(35, 72) = 1
Result: 35 and 72 are relatively prime.
Solution:
Factors of 46: 1, 2, 23, 46
Factors of 105: 1, 3, 5, 7, 15, 21, 35, 105
GCD(46, 105) = 1
Result: 46 and 105 are relatively prime.
Solution:
Factors of 14: 1, 2, 7, 14
Factors of 28: 1, 2, 4, 7, 14, 28
GCD(14, 28) = 14
Result: 14 and 28 are not relatively prime.