Posted By

chroto on 05/21/10


Tagged


Versions (?)

Project Euler - Problem 16


 / Published in: Python
 

  1. #!/usr/bin/python
  2.  
  3. # Project Euler - Problem 16
  4.  
  5. print "\nProject Euler - Problem 16"
  6. print " What is the sum of the digits of 2^1000?\n"
  7.  
  8. num = 2**1000
  9. sum = 0
  10. str = str(num)
  11.  
  12. for x in str:
  13. sum += int(x)
  14.  
  15. print sum

Report this snippet  

You need to login to post a comment.