Skip to main content

Euler 0013

The Problem:

There is 100 50-digit numbers that needed to be summed together. The attached file has been added to do this.

Considerations:

In python this problem is irrelevant because we can fit giant numbers into the integer space and python will work with it.

The Approach:

We read the file, sum the numbers, convert to string, and then convert back into number after slicing the first 10 digits.

The Code:

numbers_file = open("numbers.txt", "r")

total = 0
for number in numbers_file:
    total += int(number)

print(str(total)[:10])