haskell 009

master
Evan Hemsley 2020-10-28 02:22:47 -07:00
parent bd49d34be8
commit 779e56d0a5
1 changed files with 9 additions and 0 deletions

9
haskell/euler009.hs Normal file
View File

@ -0,0 +1,9 @@
module Main where
is_int num = num == fromInteger (round num)
-- this is a kludge - does haskell let us search an iterator?
pythagorean_triples = [(a, b, c) | b <- [1..], a <- [1..b], let c = sqrt (a * a + b * b), is_int c && (a + b + c == 1000.0) ]
main = do
print $ (\(a, b, c) -> a * b * c) $ last $ take 1 pythagorean_triples