Share via


Project Euler Problem #9

Pythagorean triplet where a + b + c = 1000

(2, 1)
|> Seq.unfold (fun (m, n) –>
    Some([m * m - n * n; 2 * m * n; m * m + n * n],
        if n + 1 < m then m, n + 1 else m + 1, 1))
|> Seq.find (fun t -> List.sum t = 1000)
|> List.fold (*) 1