Last active
August 29, 2015 14:23
-
-
Save gallais/8b0bc3347f148ee29ba5 to your computer and use it in GitHub Desktop.
Not quite tweetable. :(
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Primes where | |
import Control.Monad | |
primesFrom [] = [] | |
primesFrom (x:xs) = x : primesFrom (filter ((0 /=) . (`mod` x)) xs) | |
main = do | |
let c = primesFrom [2..200] | |
print $ length $ do | |
p <- c | |
q <- c | |
r <- c | |
guard (p + q^2 + r^3 == 200) | |
return (p, q, r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment