Sieve of Eratosthenes
The Sieve of Eratosthenes is an ancient algorithm used to find all prime numbers up to a specified integer. It works by iteratively marking the multiples of each prime number starting from 2. The numbers that remain unmarked at the end of the process are the prime numbers.
To use the sieve, you create a list of consecutive integers from 2 to the desired limit. You then start with the first number, 2, and mark all of its multiples. This process continues with the next unmarked number until you reach the square root of the limit, efficiently identifying all primes in the list.