Idris2/benchmark/benchmarks/triples/triples.idr

11 lines
266 B
Idris
Raw Normal View History

2021-01-12 16:22:58 +03:00
module Main
triples : Int -> List (Int, Int, Int)
triples top = [(x,y,z) | z<-[1..top], y<-[1..z], x<-[1..y],
x * x + y * y == z * z ]
main : IO ()
main = do putStrLn "Max: "
max <- getLine
printLn (triples (cast max))