| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 1024 MB | 2 | 2 | 2 | 100.000% |
Define $\mathbb{P}_{LR} = \mathbb{P} \cap [L;R],ドル where $\mathbb{P}$ is the set of prime numbers. In other words, $\mathbb{P}_{LR}$ is the set of all primes between $L$ and $R$ inclusive.
Given $L$ and $R,ドル find the number of integers that can be represented as XOR of some (possibly empty) subset of $\mathbb{P}_{LR}$.
The first line of input contains one integer $T$ (1ドル \le T \le 100$) --- the number of independent test cases you need to process. Descriptions of $T$ test cases follow.
The description of one test case consists of two integers $L$ and $R$ (2ドル \le L \le R \le 10^{12}$).
For each test case print the answer on a separate line.
3 2 10 999999940 1000000000 2 1000000000000
8 1 1099511627776
In the first example, $\mathbb{P}_{LR} = \{ 2, 3, 5, 7 \}$.
In the second example, $\mathbb{P}_{LR} = \varnothing,ドル so only 0ドル$ can be represented as XOR of some subset.