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