1. # +--------------------------------------------------------------------------+
  2. # | 2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26. |
  3. # | |
  4. # | What is the sum of the digits of the number 2^1000? |
  5. # +--------------------------------------------------------------------------+
  6.  
  7. # Populate a list, L, with the digits of 2^1000
  8. x = 2**1000
  9. S = str(x)
  10. L = []
  11. for x in range(len(S)):
  12. L.append(int(S[x]))
  13.  
  14. # And add them
  15. sum = 0
  16. for x in range(len(L)):
  17. sum += L[x]
  18.  
  19. print sum
  20.