Project Eluer - 16

来源:互联网 发布:阿里云国际版没信用卡 编辑:程序博客网 时间:2024/06/02 18:26

Power digit sum

Problem 16

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?


翻译: 2的15次方等于32768, 每一位数字之和为 3+2+7+6+8=26 . 那么2的1000次方的每一位数字之和为多少?


解决方案:

一看到这个题,反应的第一件事就是 python,自带大数库就是牛逼。

# encoding=utf-8result = 0for i in str(2**1000):result += int(i)print result

搞定了,答案:1366.

0 0