import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc=new Scanner(System.in);
int p=sc.nextInt();
for(int i=0;i<p;i++){
int m=sc.nextInt();
int n=sc.nextInt();
prime(m,n);
}
}
static void prime(int low,int high){
int c=0;
while (low < high) {
boolean flag = false;
for(int i = 2; i <= low/2; ++i) {
// condition for nonprime number
if(low % i == 0) {
flag = true;
break;
}
}
if (!flag && low != 0 && low != 1){
c++;
}
++low;
}
System.out.println(c);
}
}
Unable to pass all the test cases due to brute force approach. what other approach can be used?