diff --git a/60_alt b/60_alt new file mode 100755 index 0000000..d740359 Binary files /dev/null and b/60_alt differ diff --git a/60_alt.hi b/60_alt.hi new file mode 100644 index 0000000..9c84ceb Binary files /dev/null and b/60_alt.hi differ diff --git a/60_alt.hs b/60_alt.hs new file mode 100644 index 0000000..be51df8 --- /dev/null +++ b/60_alt.hs @@ -0,0 +1,20 @@ +import Data.List + +upper = 10000 + +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] + +isPrimeNew :: Int -> Bool +isPrimeNew x + | x <= upper = elem x primes + | otherwise = isPrime x + +isPrimePair :: Int -> Int -> Bool +isPrimePair a b = isPrime(read(show a ++ show b)) && isPrime(read(show b ++ show a)) + +primePairs = [(a, b) | a <- primes, b <- primes, a < b, isPrimePair a b] + +main = print primePairs diff --git a/60_alt.o b/60_alt.o new file mode 100644 index 0000000..2578150 Binary files /dev/null and b/60_alt.o differ