Project Euler Problem 16

Problem 16

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?
2 1000各位数之和是多少?
s = str(2**1000)
sum1 = 0
for i in s:
    sum1 += int(i)
print(sum1)
结果:1366

猜你喜欢

转载自blog.csdn.net/wxinbeings/article/details/80099831