Sieve of eratosthenes

how does this algorithm actually works

Hi @Cheshtha,Seive of eratosthenes is basically used to find all the prime numbers in a given range of numbers say n.We take a boolean array and there we go to all the elements in that array and if that element is not initially false(ie element at ith index of the array is taken as true when it is not a multiple of any number) then we will go to every multiple of that number before n and mark it as false and continue like this further,as a result we will get all the prime numbers in that range of n and the numbers are those which have true at their ith position.

Hi Cheshtha
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.

Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.