#include #include #include #include using namespace std; typedef long long LL; int IsPrime (int n) { int i; if (n < 2){ return 0; }else if (n == 2){ return 1; } if (n % 2 == 0){ return 0; } double sqrtNum = sqrt((double)n); for (i = 3; i <= sqrtNum; i += 2){ if (n % i == 0 ){ return 0; } } return 1; } int main(int argc, char* argv[]) { int N; cin>>N; int i,j,k; LL ans=0; map myMap; map::iterator mit; for (i=3;i<=300000;i+=2){ if (IsPrime(i)){ myMap[i]=1; } } vector Prime; for (i=3;i<=N;i+=2){ mit=myMap.find(i); if (mit==myMap.end()){ Prime.push_back(i); } } int PrimeNum=Prime.size(); for (i=0;i