human
Finding ' k ' such that its modulus with each array element is same | Prints all k such that arr [ i ] % k is same for all i.
sort the numbers.
max difference will be the difference between first and last element of sorted array.
Case when all the array elements are same.
Find all divisors of d and store in a vector v [ ].
check for each v [ i ] if its modulus with each array element is same or not.
checking for each array element if its modulus with k is equal to k or not.
if check is true print v [ i ].
Driver Code"
Solution in Python:
 What is a code to finding ' k ' such that its modulus with each array element is same and the other steps required?
assistant
#Here is code to finding ' k ' such that its modulus with each array element is same and the other steps required.
 def printEqualModNumbers ( arr , n ) :
	arr . sort ( ) ;
	d = arr [ n - 1 ] - arr [ 0 ] ;
	if ( d == 0 ) :
		print ( " Infinite ▁ solution " )
		return
	v = [ ] ;
	i = 1 ;
	while ( i * i <= d ) :
		if ( d % i == 0 ) :
			v . append ( i ) ;
			if ( i != d / i ) :
				v . append ( d / i ) ;
		i += 1 ;
	for i in range ( len ( v ) ) :
		temp = arr [ 0 ] % v [ i ] ;
		j = 1 ;
		while ( j < n ) :
			if ( arr [ j ] % v [ i ] != temp ) :
				break ;
			j += 1 ;
		if ( j == n ) :
			print ( v [ i ] , end = " ▁ " ) ;
arr = [ 38 , 6 , 34 ] ;
printEqualModNumbers ( arr , len ( arr ) ) ;