您的位置:首页 > 其它

projecteuler---->problem=16----Power digit sum

2014-06-03 15:47 483 查看
215 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.

What is the sum of the digits of the number 21000?

翻译:

215 = 32768的各位数之和为3 + 2 + 7 + 6 + 8 = 26。

那么21000的各位数之和为……?

import math
m=pow(2,1000)
s=0
while m>0:
    s+= m%10
    m /= 10
print s
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: