筛选法素数打表
#include <cstdio>
#include <iostream>
#include <cmath>
using namespace std;
const int maxn=1000010;
bool isP[maxn];
int n;
void init(){
for(int i=2;i<maxn;++i){
isP[i]=1;
}
for(int i=2;i<maxn;++i){
if(isP[i]){
for(int j=2;j*i<maxn;++j){
isP[i*j]=0;
}
}
}
}
int main(){
init();
while(scanf("%d",&n)==1){
int bnd=sqrt(n*1.0);
int i;
for(i=2;i<=bnd;++i){
if(n%i==0&&isP[i]&&isP[n/i]){
break;
}
}
if(i<=bnd){
printf("Yes\n");
}else{
printf("No\n");
}
}
return 0;
}