Last active
August 29, 2015 14:19
-
-
Save Zimmux/fb31e1cc769ea4dbe257 to your computer and use it in GitHub Desktop.
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
def Integers(): | |
n = 0 | |
while True: | |
yield n | |
n += 1 | |
def Universe(): | |
for s in Integers(): | |
for a in Integers(): | |
if a>s: break | |
for b in Integers(): | |
if a+b>s: break | |
yield a,b,s-a-b | |
U = lambda a,b,c: \ | |
isinstance(a,int) and \ | |
isinstance(b,int) and \ | |
isinstance(c,int) | |
S0 = lambda a,b,c: \ | |
U(a,b,c) and \ | |
a>0 and \ | |
b>0 and \ | |
c>0 and ( \ | |
a == b+c or \ | |
b == a+c or \ | |
c == a+b \ | |
) | |
S1 = lambda a,b,c: \ | |
S0(a,b,c) and \ | |
S0(b+c,b,c) and \ | |
S0(abs(b-c),b,c) | |
S2 = lambda a,b,c: \ | |
S1(a,b,c) and \ | |
S1(a,a+c,c) and \ | |
S1(a,abs(a-c),c) | |
S3 = lambda a,b,c: \ | |
S2(a,b,c) and \ | |
S2(a,b,a+b) and \ | |
S2(a,b,abs(a-b)) | |
S4 = lambda a,b,c: \ | |
S3(a,b,c) and \ | |
a == 65 and ( \ | |
not S3(b+c,b,c) or \ | |
not S3(abs(b-c),b,c) \ | |
) | |
for a,b,c in Universe(): | |
if S4(a,b,c): | |
print a,b,c | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment