#16 - Power digit sum

$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}$?


As said in #13 - Large sum, Python is really good at handling large numbers. All we have to do here is compute teh large power, convert it to string, and add all the digits.

# file: "problem016.py"
# Create array of digits in 2 ^ 1000
num = [int(i) for i in str(2 ** 1000)]
# Add them up
print(sum(num))

Running this short code,

1366
0.00012523456790123458 seconds.

Therefore, the sum of the digits is 1366.