Sieve of Eratosthenes Algorithm

Adam Shaffer
4 min readFeb 15, 2021

Finding Prime Numbers from 1 to n

Sieve of Eratosthenes is one of the most ancient algorithms dating from the 2nd century in ancient Greece. Old does not mean obsolete, however. This algorithm is still relevant today, being a space and time-efficient way to find prime numbers. The idea is straightforward and depicted in the grid below.

Algorithm Explanation

source: Wikipedia

--

--

Adam Shaffer

A full-stack software developer who likes writing about tech.