human
Find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 ... | Function that will return nth term.
Get n.
Get the value.
Get n.
Get the value"
How can the above be solved in Python?
 Can you provide a code to find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8?
assistant
#Here is code to find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 .
 def getValue ( n ) :
	i = 0 ;
	k = 1 ;
	while ( i < n ) :
		i = i + k ;
		k = k * 2 ;
	return int ( k / 2 ) ;
n = 9 ;
print ( getValue ( n ) ) ;
n = 1025 ;
print ( getValue ( n ) ) ;