The shortest method takes 31 steps:
- XS from pole 1 to pole 3
- S from pole 1 to pole 2
- XS from pole 3 to pole 2
- M from pole 1 to pole 3
- XS from pole 2 to pole 1
- S from pole 2 to pole 3
- XS from pole 1 to pole 3
- L from pole 1 to pole 2
- XS from pole 3 to pole 2
- S from pole 3 to pole 1
- XS from pole 2 to pole 1
- M from pole 3 to pole 2
- XS from pole 1 to pole 3
- S from pole 1 to pole 2
- XS from pole 3 to pole 2
- XL from pole 1 to pole 3
- XS from pole 2 to pole 1
- S from pole 2 to pole 3
- XS from pole 1 to pole 3
- M from pole 2 to pole 1
- XS from pole 3 to pole 2
- S from pole 3 to pole 1
- XS from pole 2 to pole 1
- L from pole 2 to pole 3
- XS from pole 1 to pole 3
- S from pole 1 to pole 2
- XS from pole 3 to pole 2
- M from pole 1 to pole 3
- XS from pole 2 to pole 1
- S from pole 2 to pole 3
- XS from pole 1 to pole 3
First, to find the shortest method, pretend there is only one hoop. Obviously, you only have to move it to the third pole, and you're done.
Then, the case with two hoops. You have to move the top hoop to the 'extra' pole (2), then move the bottom hoop to the third pole, and then put the smaller hoop back on top of it.
For three hoops, you have to move the top two hoops to the extra pole (the same way you would put two hoops onto the third pole), then put the third one where you want it, and put the two hoops back on top of it (again, the same way as moving just two hoops).
Thus, it can be reasoned that the least number of steps it takes to move n hoops will twice the number of steps it took to move n-1 hoops, plus the one step to move the largest hoop to the third pool. (Sn = 2Sn-1 + 1).
The least number of moves it will take to move 5 hoops, then, is:
2(2(2(2(1)+1)+1)+1)+1=31
Several methods were offered in the comments to solve this.
Charlie posted a BASIC program here that uses recursion to solve the problem.
DJ posted a C++ program here with a similar recursion, that also shows the state of the poles after each move.
Frederico Kereki posted a simple, non-recursive method here that also yields the simplest solution. |