Advertisement
Guest User

Untitled

a guest
May 26th, 2015
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. def Integers():
  2. n = 0
  3. while True:
  4. yield n
  5. n += 1
  6.  
  7. def Universe():
  8. for s in Integers():
  9. for a in Integers():
  10. if a>s: break
  11. for b in Integers():
  12. if a+b>s: break
  13. yield a,b,s-a-b
  14.  
  15. U = lambda a,b,c: \
  16. isinstance(a,int) and \
  17. isinstance(b,int) and \
  18. isinstance(c,int)
  19.  
  20. S0 = lambda a,b,c: \
  21. U(a,b,c) and \
  22. a>0 and \
  23. b>0 and \
  24. c>0 and ( \
  25. a == b+c or \
  26. b == a+c or \
  27. c == a+b \
  28. )
  29.  
  30. S1 = lambda a,b,c: \
  31. S0(a,b,c) and \
  32. S0(b+c,b,c) and \
  33. S0(abs(b-c),b,c)
  34.  
  35. S2 = lambda a,b,c: \
  36. S1(a,b,c) and \
  37. S1(a,a+c,c) and \
  38. S1(a,abs(a-c),c)
  39.  
  40. S3 = lambda a,b,c: \
  41. S2(a,b,c) and \
  42. S2(a,b,a+b) and \
  43. S2(a,b,abs(a-b))
  44.  
  45. S4 = lambda a,b,c: \
  46. S3(a,b,c) and \
  47. a == 65 and ( \
  48. not S3(b+c,b,c) or \
  49. not S3(abs(b-c),b,c) \
  50. )
  51.  
  52. for a,b,c in Universe():
  53. if S4(a,b,c):
  54. print a,b,c
  55. break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement