Deepak and primes doubt

wrote code for prime sieve


can u help me modify it for deepak and primes problem

take a count variable initialized with 0 then increment the count when you find p[i]==1
and when count == N the cout<<i
and you have to traverse over the p(prime array created by sieve)

i am asking what should i pass as n when calling function

may u edit code
that would be helpful

you can refer this