How to generate prime numbers up to 10^9 in 2.2 seconds?

Revision en2, by TUDORTEA, 2020-09-22 21:20:31

Link of the problem is https://www.spoj.com/problems/PRIMES2 .

Which algorithm should be used to solve this problem? And how wheelSieve + segmentedSieve is implemented?

Thank you in advance.

Tags #number theory, #primes, #sieve, prime number

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English TUDORTEA 2020-09-22 21:20:31 4 Tiny change: '? And how wheelSieve + segment' -> '? And how **wheelSieve** + segment'
en1 English TUDORTEA 2020-09-22 09:58:15 252 Initial revision (published)