Sieve of Eratosthenes
defaultAnother short post while I finish a project I’m working on.
I thought I’d continue on from the last post by discussing another algorithm to find prime numbers.
The sieve of Eratosthenes is an algorithm attributed to the Greek polymath Eratosthenes, it iterates through a list upto n and marks multiples of each prime as composite.
To implement this I’ve created an object to represent each number and store whether it’s prime.
Read more...