Created
May 13, 2012 20:46
-
-
Save peterldowns/2690104 to your computer and use it in GitHub Desktop.
Project Euler Problem #28
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
spiral_side = 1001 | |
num_corners = spiral_side/2 | |
total = 1 | |
corners = (1, 1, 1, 1) | |
additions = (2, 4, 6, 8) | |
for i in xrange(num_corners): | |
corners = map(sum, zip(corners, additions)) | |
additions = map(lambda x: x+8, additions) | |
total += sum(corners) | |
print total |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment