#P8842. XOR Prime Queries
XOR Prime Queries
XOR Prime Queries
Little Ka recently became fascinated with prime numbers, and he wants to transform any number into a prime number! You are given queries. For each query, a number is provided. Your task is to count how many non-negative integers (with ) satisfy that is a prime number, where denotes the bitwise XOR operation. A number is considered prime if it is greater than 1 and has no divisors other than 1 and itself.
For example, if , then the possible values of are 0, 1, 2, 3, and 4. Evaluating , we obtain 5, 4, 7, 6, and 1 respectively; among these, 5 and 7 are prime numbers, so the answer is 2.
inputFormat
The first line contains an integer , the number of queries. Each of the following lines contains an integer .
outputFormat
Output lines, each containing the count of non-negative integers (with ) such that is a prime number.
sample
1
5
2
</p>