#abc084d. [abc084_d]2017-like Number
[abc084_d]2017-like Number
Problem Statement
We say that a odd number is similar to 2017 when both and are prime.
You are given queries.
In the -th query, given two odd numbers and , find the number of odd numbers similar to 2017 such that .
Constraints
- and are odd.
- All input values are integers.
Input
Input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the response to the -th query.
Sample Input 1
1
3 7
Sample Output 1
2
- is similar to 2017, since both and are prime.
- is similar to 2017, since both and are prime.
- is not similar to 2017, since is not prime, although is prime.
Thus, the response to the first query should be .
Sample Input 2
4
13 13
7 11
7 11
2017 2017
Sample Output 2
1
0
0
1
Note that is also similar to 2017.
Sample Input 3
6
1 53
13 91
37 55
19 51
73 91
13 49
Sample Output 3
4
4
1
1
1
2