Created
February 21, 2014 21:01
-
-
Save rorhug/9143440 to your computer and use it in GitHub Desktop.
aipo 2013 q2
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
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