You are viewing a single comment's thread. Return to all comments →
Python:
def counterGame(n): moves = 0 while n != 1: exponent = math.log2(n) if exponent.is_integer(): n = n/2 else: n = n - 2 ** int(exponent) moves += 1
Seems like cookies are disabled on this browser, please enable them to open this website
Counter game
You are viewing a single comment's thread. Return to all comments →
Python: