一个正整数的素因子只有2,3,6,7四种则成为丑数。例如1 2 3 4 5 6 7 8 9 10 12 14 15 16 18 20 21 24
#include "iostream"
#include "cstring"
#include "cmath"
#include "cstdlib"
#include "ctime"
#include "windows.h"
using namespace std;
#define N 1000000
bool chou[N]={0};
void judge(void){
chou[0]=false;
chou[1]=true;
chou[2]=true;
chou[3]=true;
chou[5]=true;
chou[7]=true;
for(int i=1;i<N;i++){
if(chou[i])continue;
for(int j=2;j<=sqrt(i);j++){
if(i%j==0){
if(chou[j]==false||chou[i/j]==false){
chou[i]=false;
break;
}else{
chou[i]=true;
}
}
}
}
}
int main(void) {
judge();
int n;
while(scanf("%d",&n)!=EOF){
if(chou[n])cout<<"yes";else cout<<"no";
cout<<endl;
}
return 0;
}