TUDORTEA's blog

By TUDORTEA, history, 5 weeks ago, In English

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.

 
 
 
 
  • Vote: I like it
  • -19
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it +11 Vote: I do not like it

see this and please try googling stuff(to know if it's solution already exists somewhere) before posting new blog.

  • »
    »
    5 weeks ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    first of all, thank you. I tried codes from your link, but I got TLE. What should I do to avoid to TLE???

    • »
      »
      »
      5 weeks ago, # ^ |
      Rev. 2   Vote: I like it 0 Vote: I do not like it

      Read the blog ig.

      and this

      • »
        »
        »
        »
        5 weeks ago, # ^ |
          Vote: I like it 0 Vote: I do not like it

        Thank you too. I understand segmented sieve. But I don't understand how to use wheel sieve algorithm to generate prime numbers up to 10^9 in 2.2 secs. Actually, I haven't found easy understandable implementation of wheel sieve .

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by TUDORTEA (previous revision, new revision, compare).