human
Count pairs in an array whose product is composite number | Function to check if a number is prime or not.
Check if N is multiple of i or not ..
If N is multiple of i ..
Function to get the count of pairs whose product is a composite number ..
Stores the count of pairs whose product is a composite number.
Generate all possible pairs.
Stores the product of element of current pair.
If prod is a composite number.
Driver Code"
Solution in Python:
 ... Can you provide a code to count pairs in an array whose product is composite number and the other steps required?
assistant
#Here is code to count pairs in an array whose product is composite number and the other steps required.
 def isComposite ( N ) :
	for i in range ( 2 , N + 1 ) :
		if i * i > N :
			break
		if ( N % i == 0 ) :
			return True
	return False
def compositePair ( arr , N ) :
	res = 0
	for i in range ( N ) :
		for j in range ( i + 1 , N ) :
			prod = arr [ i ] * arr [ j ]
			if ( isComposite ( prod ) ) :
				res += 1
	return res
if __name__ == ' _ _ main _ _ ' :
	arr = [ 1 , 1 , 2 , 2 , 8 ]
	N = len ( arr )
	print ( compositePair ( arr , N ) )