Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def m(n, k, p, w):
- if k > max(w):
- return False
- if p:
- if n >= 100 and k in w:
- return True
- return any([m(n + 2, k + 1, not p, w),m(n + 4, k + 1, not p, w),m(n * 2, k + 1, not p, w)])
- else:
- if n >= 100:
- return False
- return all([m(n + 2, k + 1, not p, w),m(n + 4, k + 1, not p, w),m(n * 2, k + 1, not p, w)])
- a1 = list()
- a2 = list()
- for s in range(1, 99 + 1):
- if m(s, 0, True, [2, 0]):
- a1.append(s)
- for s in range(1, 99 + 1):
- if m(s, 0, True, [4, 2, 0]):
- a2.append(s)
- a3 = list()
- for el in a2:
- if not(el in a1):
- a3.append(el)
- print(min(a3), max(a3))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement