# Relatively prime number theory

Prime natural numbers
greatest common divisor of two nonzero natural numbers is 1, i.e. two prime numbers
1 and any nonzero natural numbers are coprime

Two prime number judging method
a. Two different prime numbers are relatively prime
b. A is a prime number, its number is not a multiple of the other, two prime number
c. Two adjacent natural numbers are relatively prime
d. coprime when two adjacent odd
e. 1 is the greatest common divisor of two numbers, the two prime numbers

Code:

int gcd(int a,int b)
{
	if(a % b == 0)	return b;
	else	return gcd(b,a%b);
}

int main()
{
	int a,b;	cin >> a >> b;
	if(gcd(a,b) == 1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}
Published 54 original articles · won praise 0 · Views 1160

Guess you like

Origin blog.csdn.net/magic_wenge/article/details/104748070