#include<iostream>
using namespace std;
int main()
{
int test;
cin>>test;
while(test--)
{
int start,end,m;
cin>>start;
cin>>end;
bool arr[end];
for(int i=0;i<end;i++)
arr[i]=true;
for(int i=2;(i*i)<=end;i++)
{
for(int p=2;(p*i)<=end;p++)
{
m=(p*i-1);
arr[m]=false;
}
}
for(int i=start-1;i<=end;i++)
{
if(arr[i]!=0&&i!=0)
cout<<i+1<<endl;
}
}
return 0;
}
Yogesh_9 0 Newbie Poster
Alberto Bucur 0 Junior Poster
Yogesh_9 0 Newbie Poster
NathanOliver 429 Veteran Poster Featured Poster
Alberto Bucur 0 Junior Poster
Alberto Bucur 0 Junior Poster
Yogesh_9 0 Newbie Poster
Alberto Bucur 0 Junior Poster
StuXYZ 731 Practically a Master Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.