Pagini recente » Cod sursa (job #800779) | Cod sursa (job #2988174) | Cod sursa (job #1439048) | Cod sursa (job #1005449) | Cod sursa (job #1052439)
#include <cstdio>
#include <cmath>
using namespace std;
bool c[2000001];
int ciur(int n){
int lim,gogu=0;
c[0]=c[1]=1;
lim=(int)sqrt((double)n);
for(int i=4;i<=n;i=i+2){
c[i]=1;
}
for(int i=3;i<=lim;i=i+2){
if(c[i]==0){
for(int j=2*i;j<=n;j=j+i){
c[i]=1;
}
}
}
for(int i=0;i<=n;i++){
if(c[i]==0)
gogu++;
}
return gogu;
}
int main()
{
int n;
scanf("%d",&n);
printf("%d ",ciur(n));
return 0;
}