Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def F(n):
- if n == 0:
- return 0
- if n > 0 and n % 3 == 0:
- return F(n//3)
- if n % 3 > 0:
- return (n % 3) + F(n - (n % 3))
- def G(n):
- if F(n) == 9:
- return n
- return G(n+1)
- print(G(0))
- print(F(161))
Advertisement
Add Comment
Please, Sign In to add comment