Pagini recente » Cod sursa (job #2508577) | Cod sursa (job #1527651) | Cod sursa (job #344186) | Cod sursa (job #2590560) | Cod sursa (job #2211494)
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("ciur.in");
ofstream fout ("ciur.out");
int n, cnt;
bitset<2000002>b;
void ciur () {
for (int i = 4; i <= n; i += 2)
b[i] = 1;
for (int i = 3; i * i <= n; i += 2)
if (b[i] == 0)
for (int j = i * i; j <= n; j += 2 * i)
b[j] = 1;
}
int main()
{
fin >> n;
ciur();
for (int i = 2; i <= n; i++)
if (b[i] == 0)
cnt++;
fout << cnt;
return 0;
}