Advertisement
Guest User

Pirates and mangoes

a guest
Apr 29th, 2015
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. def get_truth(mangoes):
  2.     for _ in range(5):
  3.         if mangoes % 5 != 1:
  4.             return False
  5.         mangoes = ((mangoes - 1) // 5) * 4
  6.     return not mangoes % 5
  7.  
  8. def count():
  9.     counter = 1
  10.     while True:
  11.         yield counter
  12.         counter += 1
  13.  
  14. for i in count():
  15.     if get_truth(i):
  16.         print(i)
  17.         break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement