human
Highest power of 2 that divides the LCM of first N Natural numbers . | Function to find LCM of first N natural numbers.
Initialize result.
Ans contains LCM of 1 , 2 , 3 , . . i after i 'th iteration.
Function to find the highest power of 2 which divides LCM of first n natural numbers.
Find lcm of first N natural numbers.
To store the highest required power of 2.
Counting number of consecutive zeros from the end in the given binary String.
Driver code"
Solution in Python:
assistant
#Here is code to highest power of 2 that divides the LCM of first N Natural numbers .
 def findlcm ( n ) :
	ans = 1 ;
	for i in range ( 1 , n + 1 ) :
		ans = ( ( ( i * ans ) ) // ( __gcd ( i , ans ) ) ) ;
	return ans ;
def highestPower ( n ) :
	lcm = findlcm ( n ) ;
	ans = 0 ;
	for i in range ( 1 , n ) :
		x = int ( pow ( 2 , i ) ) ;
		if ( lcm % x == 0 ) :
			ans = i ;
		if ( x > n ) :
			break ;
	return ans ;
def __gcd ( a , b ) :
	if ( b == 0 ) :
		return a ;
	else :
		return __gcd ( b , a % b ) ;
if __name__ == ' _ _ main _ _ ' :
	n = 15 ;
	print ( highestPower ( n ) ) ;