human
Write me a code to fibbinary Numbers ( No consecutive 1 s in binary ) and the other steps required given the following:
Fibbinary Numbers ( No consecutive 1 s in binary ) | function to check if binary representation of an integer has consecutive 1 s.
stores the previous last bit initially as 0.
if current last bit and previous last bit is 1.
stores the last bit.
right shift the number.
Driver code"
Solution in Python:
assistant
#Here is code to fibbinary Numbers ( No consecutive 1 s in binary ) and the other steps required.
 def checkFibinnary ( n ) :
	prev_last = 0
	while ( n ) :
		if ( ( n & 1 ) and prev_last ) :
			return False
		prev_last = n & 1
		n >>= 1
	return True
n = 10
if ( checkFibinnary ( n ) ) :
	print ( " YES " )
else :
	print ( " NO " )