Problem Description
Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.
37107287533902102798797998220837590246510135740250
46376937677490009712648124896970078050417018260538
… {data continues}
46376937677490009712648124896970078050417018260538
… {data continues}
Analysis
Only the first 11 digits of each of the 100 numbers are required for the first 10 digits of the sum. The numbers were written to a file, pe13.txt, to save space.
Solution
Runs < 1 second in Python.
f = open('pe13.txt').read().split() total = sum( [int(x[:11]) for x in f] ) print "Answer to PE13 ", str(total)[:10]





Discussion
No comments for “Project Euler Problem 13 Solution”