Problem 91

http://projecteuler.net/index.php?section=problems&id=91

三角形だと思ったら、直角三角形だった。

import Data.Array
import Data.List
p091 m = length [(a,b)|a<-area,b<-takeWhile(<a)area,not (line a b),isR a b]
where area = range((,),(m,m))
line (x,y) (u,v) = x*v==y*u
isR (x,y) (u,v) = norm(x,y)+norm(u,v)-norm(x-u,y-v)==||
norm(x,y)-norm(u,v)+norm(x-u,y-v)==||
norm(x,y)-norm(u,v)-norm(x-u,y-v)==
norm (x,y) = x*x+y*y
main = print.p091$50
More Reading
Newer// Problem 90