# Project Euler Problem 13

Project Euler Problem 13 is utterly straightforward: parse each line into a bigint, then upon aggregation add them together and take first 10 digits of the sum:

open System.IO let readLines (filePath: string) = seq { use sr = new StreamReader (filePath) while not sr.EndOfStream do yield bigint.Parse(sr.ReadLine ()) } let problem013 () = readLines @"..\..\..\Datafiles\problem013.data" |> (Seq.sum >> sprintf "%A" >> fun x -> x.Substring(0,10))

Advertisements

Leave a Comment