Pagini recente » Cod sursa (job #2283095) | Cod sursa (job #2715978) | Cod sursa (job #598734) | Cod sursa (job #2750054) | Cod sursa (job #2662906)
#include <iostream>
#include <cstdio>
using namespace std;
const int NMAX = 2000000;
const int BASE = 64;
long long ciur[NMAX / BASE + 1];
int main() {
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
int n, ans = 0;
scanf("%d", &n);
ciur[0] = 3;
for(int i = 2; i <= n; i++)
if(!( ciur[i / BASE] & ((long long)1 << (i % BASE)) )) {
ans++;
for(int j = 2 * i; j <= n; j += i)
ciur[j / BASE] |= ((long long)1 << (j % BASE));
}
printf("%d", ans);
return 0;
}