# HG changeset patch # User IBBoard # Date 1560799590 -3600 # Node ID 075ff4e4feaf5c8b5ef24bfbad86ff8792ebf936 # Parent c27c87cd0f084a183e4ac5b24a834279cb3a4174 Fix the prime checking Greatest common denominator MAY work, but it's probably inefficient (I also wondered whether it wouldn't always work, but then the number can't be a prime!) diff -r c27c87cd0f08 -r 075ff4e4feaf 7-Haskell/day2.hs --- a/7-Haskell/day2.hs Sun Jun 16 21:09:33 2019 +0100 +++ b/7-Haskell/day2.hs Mon Jun 17 20:26:30 2019 +0100 @@ -54,4 +54,4 @@ -- Wilson's theorem seems easiest: https://en.wikipedia.org/wiki/Wilson%27s_theorem primes :: [Integer] - primes = [x | x <- [2 ..], (gcd ((product [1 .. x-1]) + 1) x) == x] \ No newline at end of file + primes = [x | x <- [2 ..], (mod ((product [1 .. x-1]) + 1) x) == 0] \ No newline at end of file