SPECIAL NUMBERS(OPC practise contest Shaastra 2009)
A number is said to be special if the number of divisors it has is equal to a power of 2. For example, 6 is a special number since it has four divisors 1,2,3 and 6. A very special number is a special number whose sum of divisors is also equal to a power of 2. Given a number, print the smallest very special number that is greater than or equal to the given number.
Input:
First line of the input contains a number t, the number of test cases to follow. The next t lines each contain a number N.
Output:
Print on a new line for each test case,the smallest very special number greater than or equal to N.
Constraints:
t<5000
N<=2*10^14
Sample Input
2
23
20000000000
Sample Output
31
22545653781
Time limit: 1 second
Memory limit: 64 MB



Recent Comments