diff --git a/60_alt b/60_alt index d740359..2e664ec 100755 Binary files a/60_alt and b/60_alt differ diff --git a/60_alt.hi b/60_alt.hi index 9c84ceb..a18de97 100644 Binary files a/60_alt.hi and b/60_alt.hi differ diff --git a/60_alt.hs b/60_alt.hs index be51df8..66ba6d2 100644 --- a/60_alt.hs +++ b/60_alt.hs @@ -1,11 +1,12 @@ +{-# LANGUAGE BangPatterns #-} import Data.List -upper = 10000 +upper = 8000 isPrime :: Int -> Bool isPrime x = null [k | k <- [2..x-1], k * k <= x, x `mod` k == 0] -primes = [x | x <- [2..upper], isPrime x] +!primes = [x | x <- [2..upper], isPrime x] isPrimeNew :: Int -> Bool isPrimeNew x @@ -17,4 +18,28 @@ isPrimePair a b = isPrime(read(show a ++ show b)) && isPrime(read(show b ++ show primePairs = [(a, b) | a <- primes, b <- primes, a < b, isPrimePair a b] -main = print primePairs +primeSets = [(a, b, c, d, e) | a <- primes, + b <- primes, + a < b, + isPrimePair b a, + + c <- primes, + b < c, + isPrimePair c a, + isPrimePair c b, + + d <- primes, + c < d, + isPrimePair d a, + isPrimePair d b, + isPrimePair d c, + + e <- primes, + d < e, + isPrimePair e a, + isPrimePair e b, + isPrimePair e c, + isPrimePair e d] + + +main = print $ head primeSets diff --git a/60_alt.o b/60_alt.o index 2578150..f9ac572 100644 Binary files a/60_alt.o and b/60_alt.o differ