Let us analyze when there's re 3 rings (we number them as a, b, c from big to small) stacked in order on the peg 1.(we also number the pegs as 1, 2, 3 from left to right) For easily explaining, we called the model of 3 rings staked in order as Model 3 and so on. We will find it need 7 steps to move the Model 3 from peg 1 to peg 3. The steps are as follows.
Move c to 3.
Move b to 2.
Move c to 2.
Move a to 3.
Move c to 1.
Move b to 3.
Move c to 3.
If we stop when step 3 is finished, we can find a Model 2 on peg 2 and ring a on peg 1. And what we should do is to put ring a to the peg 3 as the bottom, and do step-by-step task to put the Model 2 on ring a. Consider about how much steps are necessary to move Model 2 from peg 1 to peg 3. The answer is 3. Now, we can consider moving Model 3 to peg 3 as "moving Model 2 to peg 2, moving the last ring a to peg 3 and ding other time to move Model 2 to peg 3". Calculate the total steps in math is as 3+1+3= 7, which is same in moving Model 4 (which is same as moving Model 3 to peg 2, moving the last ring a to peg 3 and doing other time to move Model 3, as 7+1+7=15).
So, the best way to solve the Hanoi tower problem is a recursive algorithm to recurse twice.