Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- def funn(a,b,n):
- count=(a*((n-a)//(2*a)))+b
- count=count+a
- return count
- t=int(input())
- for j in range (t):
- n=int(input())
- if math.log(n,2).is_integer():
- print("-1")
- else:
- count=0
- j=0
- while(2**j<n):
- count=funn(2**j,count,n)
- j+=1
- print(count-1)
Add Comment
Please, Sign In to add comment