Posted By

chroto on 06/11/10


Tagged


Versions (?)

Project Euler - Problem 28


 / Published in: Python
 

  1. #!/usr/bin/python
  2.  
  3. # Project Euler - Problem 28
  4.  
  5. # Find the sum of the diagonals of a 1001x1001 spiral
  6.  
  7.  
  8.  
  9. n = 1001
  10. sum = 1
  11.  
  12. for x in range(1001,1,-2):
  13. sum += ((x**2) << 2) - (6*x) + 6
  14.  
  15. print sum

Report this snippet  

You need to login to post a comment.