Project Euler 13: Find the first ten digits of the sum of onehundred 50digit numbers.
Project Euler 13 Problem Description
Work out the first ten digits of the sum of the following onehundred 50digit numbers.
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
… {data continues}
46376937677490009712648124896970078050417018260538
… {data continues}
Analysis
Corrected
The numbers to add were saved to a file, pe13.txt, read in, and summed. The sum was truncated keeping the first 10 digits.
Project Euler 13 Solution
Runs < 0.001 seconds in Python 2.7.Use this link to get the Project Euler 13 Solution Python 2.7 source.
Answer
Slowly swipe from either end beginning with the white vertical bar to get an idea of the starting or ending digits. For less drama, just double click the answer area. The distance between the two bars will give you an idea of the magnitude. Touch devices can tap and hold the center of the box between the two bars and choose define to reveal the answer.5537376230
Afterthoughts

No afterthoughts yet.
We had to copy and paste the data from the problem description and save it to a file. Yeah, I know I already mentioned that, but I just need more content so I can get this paged indexed. Anyway, how is everything? Hope you doing well and I’m glad you stopped by. Oh, don’t worry, only 30 people in the last 5 years have ever ventured to this page, so our conversation is, more than likely, quite personal and mostly private.
Have a great day – and check out some of my other pages.
Thanks,
your friend,
Mike
June 8, 2014
Project Euler 13 Solution last updated
can you explain “Only the first 11 digits of each of the 100 numbers are required to calculate the first 10 digits of the sum”?
Because the numbers are so big it becomes “noisy” in the lower digits so only 11 are required to get the top 10 in this case.
But wait, this could fail if the magnitude of the addition set or size was much smaller.
Consider the top 4 digits of the sum 999999 + 100001 = 1100000, which are 1100, but taking only the sum of the top 5 digits 99999 + 10000 = 10999 or 1099, a difference of 1. So, yes, I guess we should add all the digits to be sure we’re accurate, otherwise we could be off by one. Not very likely, but possible.
You asked a good question!
Mike
for 100 50digit, if we only check sum of first 11 digits, the offset could be 9(if all 12nd digit is 9) *100 / 100 (carry on to 10th) = 9 not 1.
BTW, you blog is awesome, I will read them one by one.
Thanks for the kind words and thanks for pointing out the problem with the solution.
Hope you enjoy the rest of the blog.