I am trying to make a efficient program to generate prime nos between two given nos (PRIME GENERATOR PROBLEM).

but couldn’t … I am beginner , so help me … Thanks !!

You should read about the Sieve of Erastothenes on the internet and try to apply that to this problem . You can also refer to my solution / any other person’s solution for reference . Just read the concept of “sieve” once and try to apply it , if you still have difficulties then message again , and I will help .

I wont tell u the implementation details but try to hint… u should try to build on that… do carefully observe the condition " n-m<=100000" its a key for solving it… keeping this in mind try to modify the sieve of eratosthenes. I think this much is more than enough for solving this problem

Best of Luck

1 Like

you can also go for segmented sieve…it works fine for calculating prime number in a segment…