The Prince of Hanoi’s Gifts

Here I will post a series of (mostly) simple challenges to amuse you in the run-up to Christmas. I'll try to post one each weekday.
DDRM
Posts: 398
Joined: Mon 02 Apr 2018, 18:04

The Prince of Hanoi’s Gifts

Post by DDRM »

The prince of Hanoi has a complex set of 7, differently-sized, gifts to be delivered. They are so large that a special sleigh has been built to transport them, but even so, they always need to be stacked with the larger ones underneath any smaller ones.

The gifts are currently stacked like a pyramid in the main warehouse. Close to the sleigh there is a platform which can also support any pile of the gifts. These (warehouse, platform, and sleigh) are the only places where the gifts can be put down. An elf can only carry one gift at a time – and indeed for the largest two gifts it takes 2 elves to carry them!

What is the minimum number of elf-trips (i.e. 1 for each movement of the smaller gifts, or 2 for a movement of the two largest ones) that is required to get all the gifts safely loaded on the sleigh?

Bonus points for a nice graphical presentation….

Hint: this is a slight variation of a well-known problem. Indeed, there is a BBC-BASIC demo of it…