Pagini recente » Cod sursa (job #2491412) | Cod sursa (job #1678037) | Cod sursa (job #238984) | Cod sursa (job #1240670) | Cod sursa (job #2641347)
#include <stdio.h>
using namespace std;
int v[2000001];
int main()
{
freopen("ciur.in", "r", stdin);
freopen("ciur.out", "w", stdout);
int n, tot = 0, i;
scanf("%d", &n);
for (int j = 2; j <= n; j++)
{
if (j % 2 == 1 && j > 2) {
bool gasit = false;
for (i = 0; i < tot; i++) {
if (j % v[i] == 0) gasit = true;
}
if (!gasit) {
v[tot] = j;
tot++;
}
}
else if (j == 2) {
v[tot] = j;
tot++;
}
}
printf("%d", tot);
return 0;
}