vector v(170,0),v1(830,0);v[0]=1;

int k=1,p=0;

//store primes in v1//store composite in v1

for (int i = 2; i <= n; i++) {

if (isPrime(i)) {

v[k]=i;

++k;

}else{

v1[p]=i;

++p;}

}

isPrime () is another function which returns if I is prime or not

I think declaration of vector is not correct.

vector `<data type>`

v(n,x); this creates vector of size n all initialized to x.

Or the code is storing too much memory.