A few more problems!
This commit is contained in:
14
problem_16.py
Normal file
14
problem_16.py
Normal file
@@ -0,0 +1,14 @@
|
||||
import math
|
||||
|
||||
#print the sum of the digits of 2^1000
|
||||
|
||||
product = str('%f' % math.pow(2, 1000))
|
||||
sum = 0
|
||||
|
||||
for char in product:
|
||||
if char == '.': # I can't really be bothered to do the conversion
|
||||
break
|
||||
sum += int(char)
|
||||
|
||||
print(product)
|
||||
print(sum)
|
||||
Reference in New Issue
Block a user