optimized seive(counting number of primes upto n)(prime number theoram on spoj)