# Project Euler Problem 6

Project Euler Problem 6 solution would be provided by the **aggregator** part. The latter would be a classic application of **fold**, where accumulator will be represented by a tuple of **([sum of items],[sum of item squares])**.

let problem006 () = [0..100] |> List.fold (fun (sum, sumsqrs) s -> (sum + s, sumsqrs + s * s))(0, 0) |> fun (sum,sumsqrs) -> sum * sum - sumsqrs

Advertisements

Leave a Comment