Skip to content

Instantly share code, notes, and snippets.

@rorhug
Created February 21, 2014 21:01
Show Gist options
  • Save rorhug/9143440 to your computer and use it in GitHub Desktop.
Save rorhug/9143440 to your computer and use it in GitHub Desktop.
aipo 2013 q2
import math
def is_whole(x):
return x % 1 == 0
n = int(raw_input())
c_list = set()
c = 5
while len(c_list) < n:
for b in xrange(1, c):
a = math.sqrt(c**2 - b**2)
if is_whole(a):
c_list.add(c)
c += 1
for sol in c_list:
print(sol)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment