/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
#!/usr/bin/python # Project Euler - Problem 16 print "\nProject Euler - Problem 16" print " What is the sum of the digits of 2^1000?\n" num = 2**1000 sum = 0 str = str(num) for x in str: sum += int(x) print sum