Problem of the day
Input:
'L' = 15 and 'R' = 19
There is only 1 number between which is good,
16 = 1 + 6 = 7 (which is a prime number).
The first line of the input contains a single integer 'T', representing the number of test cases.
The first line of each test case contains two integers ‘L’ and ‘R’.
For each test case, output a single integer denoting the number of good numbers between ‘L’ and ‘R’.
Print the output of each test case in a new line.
You don’t need to print anything. It has already been taken care of. Just implement the given function. 1 is a co-prime number.
1 <= ‘T’ <= 10
1 <= ‘L’, ‘R’ <= 10^5
Time Limit: 1 sec
2
5 11
1 20
3
9
For test case 1 we have,
5 , 7 ,
11 = 1+1 = 2
As 2, 5, 7 are prime numbers so 5, 7, 11 are good.
For test case 2 we have,
2, 3, 5, 7,
11 = 1 + 1 = 2
12 = 1 + 2 = 3
14 = 1 + 4 = 5
16 = 1 + 6 = 7
20 = 2 + 0 = 2
As 2, 3, 5, 7 are prime numbers so 2, 3, 5, 7, 11, 12, 14, 16, 20 are good.
2
12 16
9 19
3
4