Euler Project question 16 in python way

# This Python file uses the following encoding: utf-8
# 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?
import time
start = time.time()
print "2**1000's sum of digits is %s and cost %s seconds" % (sum([int(i) for i in str(2**1000)]), time.time() - start)

posted @ 2014-10-21 22:20  dergum  阅读(136)  评论(0编辑  收藏  举报