Mar 17, 2022
Has anybody played with this folk algorithm to generate prime numbers using the Sieve of Eratosthenes, creating a coroutine for each prime? Examples:
using fork()
and pipe()
: https://www.cs.dartmouth.edu/~doug/sieve/sieve.pdf
in C using tasks and channels: https://swtch.com/libtask
in Lua using tasks and channels: https://github.com/majek/lua-channels/blob/master/examples/sieve.lua
in Python using a more efficient but less interesting algo because Python lacks full coroutines: https://github.com/majek/lua-channels/blob/master/examples/sieve.lua
It might be fun to try this in Wireworld.
Comments gratefully appreciated. Please send them to me by any method of your choice and I'll include them here.