24 lines
370 B
Python
24 lines
370 B
Python
#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?
|
|
|
|
|
|
pp = 1000
|
|
|
|
c = [0 for i in range(0, pp//3+1)]
|
|
c[0] = 1
|
|
|
|
for i in range(0,pp):
|
|
r = 0
|
|
for j in range(0,len(c)):
|
|
p = c[j]*2+r
|
|
r = p//10
|
|
c[j] = p%10
|
|
s = 0
|
|
for i in c:
|
|
s += i
|
|
print( s )
|