Skip to content

Instantly share code, notes, and snippets.

@shieldsd
Created April 3, 2012 09:29
Show Gist options
  • Save shieldsd/2290657 to your computer and use it in GitHub Desktop.
Save shieldsd/2290657 to your computer and use it in GitHub Desktop.
Project Euler #39
def perimeters(n):
s = 0
for a in range(1, n / 3):
if n * (n - 2 * a) % (2 * (n - a)) == 0:
s += 1
return s
print max((perimeters(i), i) for i in range(2, 1000, 2))[1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment