just-find-the-next-number-1

You are given an integer n find its next greater or equal number whose binary representation must not contain consecutive ones.

For eg.  given n=6 whose binary is 110 and the next number with no consecutive ones is 8 whose binary is 1000.

INPUT

First line of input contains t, the total number of test cases. Then t line follows n.

0<t<100

0<n<10^5

OUTPUT

The next number on each line.
Register for IndiaHacksSAMPLE INPUT
2
6
2

SAMPLE OUTPUT
8
2

Register for IndiaHacks

Source: hackerearth | Difficulty: MEDIUM


Solutions:
test = int(input())

a = [0 for i in range(test)]
for i in range(test):
	a[i] = int(input())

for i in range(test):
	n = a[i]
	b = str(bin(n))
	while '11' in b:
		n+=1
		b = str(bin(n))
	print(n)
	

		


for i in range(int(input())):
	n=eval(input())
	for i in range(n,100001):
		if "11" not in str(bin(i)):
			print(i)
			break


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while(t>0):
	t-=1
	n=eval(input())
	while(1):
		if "11" not in bin(n):
			print(n)
			break
		n+=1


t = int(input(""))

while(t > 0):
	n = int(input(""))
	flag = 0
	while(True):
		temp = bin(n)[2:]
		flag = 1

		for i in range(len(temp)-1):
			if(temp[i] == "1" and temp[i+1] == "1"):
				flag = 0
		if(flag == 1):
			break

		n += 1
	print(n)
	t -= 1


test = int(input())
while(test):
	number = int(input())
	for i in range(1000000):
		if '11' in bin(number):
			number +=1
			continue
		else:
			break
	print(number)
	test -=1


t=eval(input())
while t>0:
	t-=1
	n=eval(input())
	for i in range(n,100001):
		if "11" not in str(bin(i)):
			print(i)
			break
			


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
t=eval(input())
while(t>0):
	t-=1
	n=eval(input())
	while(1):
		if "11" not in bin(n):
			print(n)
			break
		n+=1


def getoreqNumber():

	inp = ""

	inp = input()
	testcase = int(inp)

	for i in range(testcase):
		inp = input()
		n = int(inp)
		for j in range(n , 2**(len(bin(n))-2) + 1):
			bi = bin(j)
			if (bi.find('11') == -1):
				print(j)
				break
		

if __name__ == '__main__':
	getoreqNumber()


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
for i in range(eval(input())):
	n=eval(input())
	for j in range(n,100001):
		if "11" not in str(bin(j)):
			print(j)
			break


test = int(input())

a = [0 for i in range(test)]
for i in range(test):
	a[i] = int(input())

for i in range(test):
	n = a[i]
	b = str(bin(n))
	while '11' in b:
		n+=1
		b = str(bin(n))
	print(n)
	

		


'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
for i in range(eval(input())):
	n=eval(input())
	for j in range(n,100001):
		if "11" not in str(bin(j)):
			print(j)
			break