haskell 009
parent
bd49d34be8
commit
779e56d0a5
|
@ -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
|
Loading…
Reference in New Issue