
Eratosthenes Algorithm


First numbers are those who have as their true divisors themselves and the unit. THE
the Eratosthenes algorithm finds all the first numbers that are smaller or equal to a given
number N. Write a program in C language that will display all the first numbers between 1 and
1000. To find use of the Eratosthenes algorithm described below under
form of steps.
Create a list of numbers (ie 1-N)
Number 2 is the first but not the multiple (4,6,8 ...). Delete all multiples of 2
(ie 4,6,8, ...)
Find the first consecutive number left in the list (i.e., 3, ...) after the ones they have
delete it, check if it's first and delete all its multiples.
Repeat step 3 until the first unreaded number is found and the
its square is greater than N (termination condition).
All the numbers remaining in the list are the first numbers between 2 and N.