Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math;
- MAX = 30
- MIN = -30
- def is_perfect_cube(num):
- num = math.fabs(num)
- if math.pow(num, 1 / 3) == int(math.pow(num, 1 / 3)):
- return True;
- return False;
- def cubes_test(a, b, c, d):
- for num in [a + b, b + c, c + d, a + b + c, b + c + d, a + b + c + d]:
- if not is_perfect_cube(num):
- return False
- if len(set([a, b, c, d])) < 4:
- return False
- #print("found combo:", a, b, c, d)
- print ((a, b, c, d))
- return True
- def main():
- for a in range(MIN, MAX):
- #print(a)
- for b in range(MIN, MAX):
- for c in range(MIN, MAX):
- for d in range(MIN, MAX):
- cubes_test(a, b, c, d)
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement