3 ms·
A Lazy Sieve of Eratosthenes
- peterarmitage 13y agoI got such a good reception from my post yesterday [0] on Go's range clause that I thought I'd hurry up and publish this article today. This post is a lot more subjective - I personally think the algorithm is neat and elegant. If you agree I also recommend the paper as a good read. I remember thinking about the Sieve when I first learnt programming, and being annoyed that I couldn't just let it generate all the primes without limit. Especially as running out of memory was an issue. I like the idea that I can come back and redo one of my earliest problems from a new angle. [0] https://news.ycombinator.com/item?id=5924082 https://news.ycombinator.com/item?id=5924082