human
Maximum count of pairwise co | Function to find the gcd of two numbers.
Function to of pairwise co - prime and common divisors of two numbers.
Initialize answer with 1 , to include 1 in the count.
Count of primes of gcd ( N , M ).
Finding prime factors of gcd.
Increment count if it is divisible by i.
Return the total count.
Function Call for each pair to calculate the count of pairwise co - prime divisors.
Driver Code.
Given array of pairs.
Function Call"
How can the above be solved in Python?
assistant
#Here is code to maximum count of pairwise co and the other steps required.
 def gcd ( x , y ) :
	if ( x % y == 0 ) :
		return y
	else :
		return gcd ( y , x % y )
def countPairwiseCoprime ( N , M ) :
	answer = 1
	g = gcd ( N , M )
	temp = g
	for i in range ( 2 , g + 1 ) :
		if i * i > g :
			break
		if ( temp % i == 0 ) :
			answer += 1
			while ( temp % i == 0 ) :
				temp //= i
	if ( temp != 1 ) :
		answer += 1
	return answer
def countCoprimePair ( arr , N ) :
	for i in range ( N ) :
		print ( countPairwiseCoprime ( arr [ i ] [ 0 ] , arr [ i ] [ 1 ] ) , end = " ▁ " )
if __name__ == ' _ _ main _ _ ' :
	arr = [ [ 12 , 18 ] , [ 420 , 660 ] ]
	N = len ( arr )
	countCoprimePair ( arr , N )