#include <stdio.h>
int main() {
int n,m;
//i랑 num인덱스랑 같음
int num[1000001]={1,1,};
scanf("%d %d",&n, &m);
for(int i=2; i*i<=m; i++) {
if(num[i]==0) {
for(int j=2; i*j<=m; j++) {
//소수아님
num[i*j]=1;
}
}
}
for(int i=n; i<=m; i++) {
if(!num[i]) printf("%d\n",i);
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: