Sample Input
2
1 10
11 20
Sample Output
4
4
given in question a and b are inclusive so that then ans should be 5 both test cases
Sample Input
2
1 10
11 20
Sample Output
4
4
given in question a and b are inclusive so that then ans should be 5 both test cases
No, basically if you have a=1 and b=10, then prime nos between them is : 2, 3, 5 and 7
Thus your answer is 4
Similarly , if a=11 and b=20 , then prime nos between them is : 11, 13 , 17, 19
Thus answer is 4
time limit increses how can i solve it
Use seive of erathosenes or prime seive optimisation in your code, You can refer to the video given under Number theory of your course for the same…