Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def m(n, k ,p):
- if k > 3:
- return False
- if p:
- if n <= 10:
- return False
- return any([m(n-10, k+1, not p), m(n//3, k+1, not p)])
- else:
- if n <= 10 and (k == 3):
- return True
- return all([m(n-10, k+1, not p), m(n//3, k+1, not p)])
- c = 0
- a = list()
- for s in range(11, 9999 + 1):
- if m(s, 0, True):
- a.append(s)
- print(min(a), max(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement