A positive integer is said to be prime if it has no factors other than itself and 1. Given a set of two or more positive integers, the elements are said to be relatively prime (or 'coprime') if no two elements from the set have a common factor other than 1, i.e. the greatest common factor of any pair is 1. (Another way to think of this is that numbers are relatively prime if the least common multiple of the numbers is the same as the product of the numbers.)
If p is a prime number and x is a positive integer, x and p are relatively prime unless x is a multiple of p. Thus, any set of prime numbers are relatively prime. Some sets including composite numbers, e.g. {10, 13, 27, 49}, are relatively prime also.
If x and y are relatively prime, it can be said that x is prime relative to y.
2007-01-07 21:25:42
·
answer #1
·
answered by amiT jaiN 4
·
0⤊
0⤋
Use Euler's Algorithm for finding the GCD.
A = some_number
B = another_number
while( B != 0) {
temp = A % B;
A = B;
B = temp;
}
if( A == 1) {
print "A & B are relatively prime.";
}
2007-01-08 08:12:45
·
answer #2
·
answered by Kookiemon 6
·
0⤊
0⤋