Binary Prime
Time: 1 s
Memory: 125 MB
Memory: 125 MB
Alice calls a decimal number as “Binary Prime” if the summation of set bit of binary representation of that decimal number is prime.
Let me explain. The binary representation of 29 is 11101. Now, 1+1+1+1 = 4 is not prime.
So, 29 is not “Binary Prime”.
You are given few integers (base 10). You have to check whether it is “Binary prime” or not.
Let me explain. The binary representation of 29 is 11101. Now, 1+1+1+1 = 4 is not prime.
So, 29 is not “Binary Prime”.
You are given few integers (base 10). You have to check whether it is “Binary prime” or not.
Input
The first line contains an integer T- the number of queries. Then T test case follows.The first line of each test case contains one integer N
Constraint
1<= T <= 1001<= N <= 10^12
Output
Print “Binary prime” if the number is binary prime according to the above explanation. Otherwise, print “-1” (without quotes).Examples
Input | Output |
---|---|
5
2 3 5 29 10 |
-1
Binary prime Binary prime -1 Binary prime |
Problem Info
Problem ID | 18 |
Time Limit | 1000 ms |
Memory Limit | 128000 KB |
Moderators | Saidur , muncityuni , amit_SK |
Statistics
Submit
You need to Login or Registration for submit your solution