human
Minimum operations to make GCD of array a multiple of k | Python 3 program to make GCD of array a multiple of k ..
If array value is not 1 and it is greater than k then we can increase the or decrease the remainder obtained by dividing k from the ith value of array so that we get the number which is either closer to k or its multiple.
Else we only have one choice which is to increment the value to make equal to k.
Driver code"
Solution in Python:
 Can you provide a code to minimum operations to make GCD of array a multiple of k and the other steps required?
assistant
#Here is code to minimum operations to make GCD of array a multiple of k and the other steps required.
 def MinOperation ( a , n , k ) :
	result = 0
	for i in range ( n ) :
		if ( a [ i ] != 1 and a [ i ] > k ) :
			result = ( result + min ( a [ i ] % k , k - a [ i ] % k ) )
		else :
			result = result + k - a [ i ]
	return result
if __name__ == " _ _ main _ _ " :
	arr = [ 4 , 5 , 6 ]
	n = len ( arr )
	k = 5
	print ( MinOperation ( arr , n , k ) )