Using JavaScript to develop a recursive algorithm to solve the problem of the Nottingham Tower

Source: Internet
Author: User

Legend has it that there are three pillars in a monastery, at the beginning of the creation, the first column has 64 gold plates, and the size of the disk is smaller than that from the bottom to the previous one. The monks of the monastery moved a disk every day according to an ancient prophecy, and the market could not be stacked on top of a small plate, predicting that the world would perish when all the plates were moved to the third pillar.

The minimum number of moves is increased exponentially with the number of plates (2^n-1). Students who have a concept of exponential growth should be able to see that the number of steps needed to move 64 of plates is astronomical, even if the monks can complete a plate movement per second, it will take 584.6 billion years to complete, the entire universe is now only 13.7 billion years. The meaning of this world's demise is probably to bless the world and not perish.

In the story of the rise of the ape ball, the same question was used to measure the IQ of the chimps, using 4 plates.

Four plates need to move at least 2^4-1=15 step, the gorilla is the fastest 15 steps to complete, no wonder scientists are surprised.

Below is a children's toy with 7 plates, which requires a minimum of 2^7-1=127 steps to complete.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.