DEEPAK AND PRIMES error

https://ide.codingblocks.com/s/58397
why is this giving error

Hey,
5,000,000 th prime number is 86,028,121. Thus you need to set the size of ā€œpā€ (in your code) to a number greater than 86,028,121.

@dipansha.chhabra19
your code has following errors:

  • range fori and j in the 2 for loops in line 13 and 17 would be 10^8, this cannot be n as nth prime number will be of type 10^8.
  • you have to use bitwise sieve or use bitset. this is because when you change the range of n (as described in above point) you can not use your vector P (max size 10^7) so use bitwise sieve or simple bitset.
  • Declare vector prime as global (global vectors have greater size).

Correct Code : https://ide.codingblocks.com/s/58420

Hit like if you get it!!
Cheers Coding

1 Like