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. sum = 0
  8. for x in range(1,1001):
  9. sum += x**x
  10.  
  11. S = str(sum)
  12. L = []
  13. for x in range(len(S)):
  14. L.append(S[x])
  15.  
  16. print ''.join(L[-10:])
  17.