The Tower of Hanoi is a puzzle game consisting of a base containing three rods, one of which contains some disks on top of each other, in ascending order of diameter.
The game's objective is to move all the disks from one rod to another, so that a larger disk never lies on top of a smaller one. The number of disks can vary, the simplest format contains only three. Choose the number of disks and press "Start".
It was first publicized in the West by the French mathematician Édouard Lucas in 1883. There are several legends about the origin of the game, the best known concerns a Hindu temple, situated in the center of the universe. It is said that Brahma had supposedly created a tower with 64 gold disks of different sizes and three rods on a platform. Brahma had commanded them to move all the disks from one rod to another according to his instructions. The rules were simple: only one disk could be moved at a time and never a larger disk should be over a smaller disk. According to legend, when all the disks were transferred from one rod to another, the temple would collapse and the world would disappear.
Do we have to worry about the end of the world? Not for now! It is interesting to note that the minimum number of moves to be able to transfer all the disks from one rod to another is `2^n-1`, where `n` is the number of disks. If the tower had 64 disks, this implies a minimum of 18,446,744,073,709,551,615 movements, even if we did one move per second it would take approximately 585,000,000,000 years to complete the task. We can sleep rested!