A sieve of some greek bloke solution

```
int countPrimes(int n)
{
vector<bool> v(n,true);
v[0]=false;
v[1]=false;
int k=v.size()/2;
for(int i=2; i<=k; i++)
{
if(v[i])
{
for(int j=i*2; j<v.size(); j += i)
v[j]=false;
}
}
int counter=0;
for(int i=0; i<n; ++i)
{
if(v[i])
++counter;
}
return counter;
}
```