Concept Flow - Sieve of Eratosthenes Find All Primes
Initialize array of size n+1 with True
Set 0 and 1 to False
Start with p = 2
Is p * p <= n?
No→Collect primes where True
Yes
Mark multiples of p as False
Increment p
↩Back to check p * p <= n
Start with all numbers marked prime, then repeatedly mark multiples of each prime as not prime until p squared exceeds n, then collect all primes.
