BigInteger

Project Euler 13: Sum of 50-digit numbers

There is nothing particularly mathematically interesting in Problem 13 of Project Euler.  Since the question is about summing numbers. The tricky part of the question is that the numbers are so big they don’t fit into an ordinary data type. The question goes

Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.

I have left out the actual numbers, but check the question for them.  I originally solved the question using arrays of integers to store each number in, and then I thought I was very smug and all. But when I sought a bit of inspiration on the internet before writing this blog post, I realised that many other languages has built in support for large integers. Continue reading →

Posted by Kristian in Project Euler, 23 comments