Nihar_17

Untitled

May 25th, 2020
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.35 KB | None | 0 0
  1. import math
  2. def funn(a,b,n):
  3.     count=(a*((n-a)//(2*a)))+b
  4.     count=count+a
  5.     return count
  6. t=int(input())
  7. for j in range (t):
  8.     n=int(input())
  9.     if math.log(n,2).is_integer():
  10.         print("-1")
  11.     else:
  12.         count=0
  13.         j=0
  14.         while(2**j<n):
  15.             count=funn(2**j,count,n)
  16.             j+=1
  17.         print(count-1)
Add Comment
Please, Sign In to add comment