## Project Euler #13

Problem : Find the first ten digits of the sum of one-hundred 50-digit numbers.

Answer: **5537376230**

Solution:

Thanks to this article, I got a good tip for reading file contents line by line, the Functional way. Since these were big numbers I used F# BigInt to solve the problem

var lContent = ReadLines("Problem13.txt") .Select(pArg => BigInt.Parse(pArg)); var lAnswer = lContent.Aggregate(BigInt.Zero, (pSeed, pId) => pSeed + pId).ToString().Substring(0, 10);

Time: 25 ms

Advertisements

## Leave a Reply