The Tower of Hanoi problem involves 3 towers.  A number of rings decreasing in size are placed on one tower.  All rings must then be moved to another tower, but at no point can a larger ring be placed on a smaller ring.

Your task:  Given a number of rings, return the MINIMUM number of moves needed to move all the rings from one tower to another.

Reference: Tower of Hanoi, Courtesy of Coolmath Games

NB:  This problem may seem very complex, but in reality there is an amazingly simple formula to calculate the minimum number.  Just Learn how to solve the problem via the above link (if you are not familiar with it), and then think hard.  Your solution should be in no way extraordinarily long and complex.  The Kata ranking is for figuring out the solution, but the coding skills required are minimal.

Difficulty: introductory

Starter code:

def tower_of_hanoi(rings):
	

Solutions:
def tower_of_hanoi(rings):
    return 2**rings - 1

def tower_of_hanoi(rings):
    moves = 2**rings - 1
    return moves

def tower_of_hanoi(rings):
    answer = 1
    for i in range(rings-1):
        answer = (answer *2) +1
    return answer

def tower_of_hanoi(r):
    return ~(-1<<r)

def tower_of_hanoi(rings):
    return int('1' * rings, 2)

tower_of_hanoi=lambda r: (1<<r)-1

def tower_of_hanoi(rings):
    count = 7
    for i in range(4,rings+1):
        count = count*2 + 1
        
    return count

def tower_of_hanoi(rings):
    def hanoi(n):
        if n==1:
            return 1
        else:
            return 2*hanoi(n-1)+1
    return hanoi(rings)
    #your code here


def tower_of_hanoi(rings):
    moves = 0
    for r in range(rings):
        moves *= 2
        moves += 1
    return moves




def tower_of_hanoi(rings):
    moves = 7
    r = 3
    while r < rings:
        moves = (moves * 2) + 1
        r += 1
    return moves