Subject: New simplified primes; no VIP necessary.
Date: Thursday 23rd December 2010 08:08:00 UTC (over 6 years ago)
Hi, For those who remember the discussion about this about a year ago, it turns out there was a simpler version after all lurking somewhere in there (or is it _out_?). I've just posted it to the haskellwiki's Prime Numbers page: primes = 2: primes' where primes' = 3: 5: [7,9..] `minus` tfold [ [p*p,p*p+2*p..] | p <- primes' ] tfold ((x:xs):t) = x : xs `union` tfold (pairs t) pairs ((x:xs):ys:t) = (x: union xs ys) : pairs t The full code with double-feed, wheel and better folding structure is also there. Speed and complexity weren't changed by this. But it is rather _short_. :) Cheers,