My solutions to the problems found at Project Euler.
Jump to: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 20 | 21 | 22 | 25 | 3-2 |#! /usr/bin/python
# Problem: Find the first ten digits of the sum of the following one-hundred 50-digit numbers.
# Approach: Uh, add them?
import re
if __name__ == "__main__":
f = open('13.txt','r') # File containing our one-hundred 50-digit numbers.
numbers = f.readlines()
for i in xrange(len(numbers)):
re.sub(r'\s', '', numbers[i])
numbers[i] = long(numbers[i])
sum = 0
for number in numbers:
sum += number
print str(sum)[:10]