Brute force algorithm with no real optimizations.

let problem39c = let countTriplets p = let mutable count = 0 for a in 1..p do for b in a..p do let c = p - (a + b) |> float let c' = a*a + b*b |> float |> sqrtF if c = c' then count <- count + 1 count {1..1000} |> PSeq.maxBy countTriplets

## No comments:

## Post a Comment