Currently viewing the tag: "infinity"
Create a list of primes “as you go”, considering a number prime if it can’t be divided by any number already considered prime.
… However, although my straightforward solution worked on discrete ranges, it couldn’t yield a single prime when called on an infinite range — something I’m completely unused to from other languages, except for some experience with the SERIES library in Common Lisp.
… But when I suggested this on #haskell , someone pointed out that you can’t reverse an infinite list.
…This time when I put primes [1..] into GHCi it printed out prime numbers immediately, but visibly slowed as the accumulator grew larger.
Recent Comments
- Pablo Cabrera on Neat tricks with iptables
- Xah Lee on Letter to the Free Software Foundation
- Jonathan Fischoff on A word on Haskell Monads and C++
- Yakir Gagnon on Using org-mode as a Day Planner
- Giuseppe Maggiore on A word on Haskell Monads and C++
