# Project Euler Problem 9

Project Euler Problem 9 solution is very straightforward:

- Make sequence of tuples where
**a < b < c**and**a + b + c = 1000** - Find from this sequence one that is Pythagorean, i.e.
**a**^{2}+ b^{2}= c^{2} - Return the product of tuple members

let tripletsSum1000 = seq { for a in 1 .. 333 do for b in a + 1 .. 499 do let c = 1000 - b - a if a < b && b < c then yield (a,b,c) } let problem009 () = tripletsSum1000 |> Seq.find (fun (a,b,c) -> a * a + b * b = c * c) |> fun (a,b,c) -> a*b*c

Advertisements

Leave a Comment