Initially the list contains the integer . In each step, the smallest number on the list is removed (denote this number by ), and the numbers and are added to the end of the list if they are not on the list already.
Your task is to determine the smallest number on the list when all the steps have been completed. For example, when the number of steps is , the list changes as follows:
In this case, the smallest number at the end is .
In a file twothree.py
, implement the function find_smallest
that takes the nunber of steps as a parameter. The function should return the smallest number on the list after the steps.
Implement the function so that every step is executed quickly. The function should return immediately even with the last test case in the code template.
def find_smallest(steps): # TODO if __name__ == "__main__": print(find_smallest(0)) # 1 print(find_smallest(1)) # 2 print(find_smallest(2)) # 3 print(find_smallest(3)) # 4 print(find_smallest(4)) # 6 print(find_smallest(5)) # 8 print(find_smallest(42)) # 1296 print(find_smallest(1337)) # 16210220612075905068 print(find_smallest(123123)) # 47241633171870338440585357243035120029747450090811731814934867117962334088709324512562801224664331563355142646399182644605958987116029586018592281978123083613432358051028210559768563023872