Hello everyone,

I have been on this question for a while now and learnt about sieve theorem for prime numbers, I have implemented this theorem using bitsets.

I am exceeding the time limit and I would like to know how I can optimize it.

The problem I can see is that it had 3 for loops and that is increasing the time.

Problem : https://www.codechef.com/problems/PRIME1

My code : https://github.com/supreetsingh10/help-lol-/blob/master/Primegenerator.CPP

My solution : https://www.codechef.com/viewsolution/33562221

Note:

I was updating this code as I was typing this, so I have continously made changes, now I am getting a runtime error.