ProjectEuler/Problem_016.py

16 lines
368 B
Python
Raw Permalink Normal View History

2018-10-11 22:05:31 +02:00
######################################################################
# 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
#
# What is the sum of the digits of the number 2^1000?
######################################################################
number = str(pow(2, 1000))
sum = 0
for c in number:
sum += int(c)
print(sum)
2018-10-11 22:48:12 +02:00
# Solution: 1366