Skip to content

Files

Latest commit

0f37be8 · Jan 24, 2021

History

History
18 lines (15 loc) · 378 Bytes

13. Large sum.md

File metadata and controls

18 lines (15 loc) · 378 Bytes

Question

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

Solution

Brute force

def p13():
    ans = 0
    with open("p13.txt", 'r') as f:
        for l in f.readlines():
            ans += int(l.strip())
    return str(ans)[:10]

Answer

5537376230