The article outlines a method for finding primes, has exercises along the way to build on it, and even concludes with optimization strategies to cut down the computing cost of running it.

If you have any specific questions after you look this over, then be sure to post again.

But we built it intuitively, from the model given. That’s more important. Being able to envision a model and then build from it is working toward a goal.

Technically we know that we don’t have to iterate a sequence. Just a list of the primes less than or equal the square root of N is enough. That takes some memoizaiton, though, and is another path on the road to optimizing this algorithm.

A sieve is not enough, we need an object. That becomes evident.