• Aucun résultat trouvé

Episode 18 – The Tower of Hanoi European section – Season 3

N/A
N/A
Protected

Academic year: 2022

Partager "Episode 18 – The Tower of Hanoi European section – Season 3"

Copied!
28
0
0

Texte intégral

(1)

Episode 18 – The Tower of Hanoi

European section – Season 3

(2)

The legend

The puzzle was invented by the French mathematician Édouard Lucas in 1883. It’s based on a Vietnamese or Indian legend about temple which contained a large room with three time-worn posts in it surrounded by 64 golden disks.

Episode 18 – The Tower of Hanoi

(3)

The legend

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post to the third, in accordance with the following rules :

(4)

The legend

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post to the third, in accordance with the following rules :

Only one disk may be moved at a time.

Episode 18 – The Tower of Hanoi

(5)

The legend

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post to the third, in accordance with the following rules :

Only one disk may be moved at a time.

Each move consists of taking the upper disk from one of the posts and sliding it onto another post, on top of the other disks that may already be present on that post.

(6)

The legend

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post to the third, in accordance with the following rules :

Only one disk may be moved at a time.

Each move consists of taking the upper disk from one of the posts and sliding it onto another post, on top of the other disks that may already be present on that post.

No disk may be placed on top of a smaller disk.

Episode 18 – The Tower of Hanoi

(7)

The legend

The priests of Brahma, acting out the command of an ancient prophecy, have been moving these disks from the first post to the third, in accordance with the following rules :

Only one disk may be moved at a time.

Each move consists of taking the upper disk from one of the posts and sliding it onto another post, on top of the other disks that may already be present on that post.

No disk may be placed on top of a smaller disk.

According to the legend, when the last move of the puzzle is completed, the world will end.

(8)

Problem 1

Find a solution for 2 disks, for 3 disks and for 4 disks. Count the number of moves needed and

try to lower it as much as possible.

Episode 18 – The Tower of Hanoi

(9)

Problem 2

Where must we move the first disk ?

Is their a simple algorithm to solve the puzzle ?

(10)

Problem 3

What is the lowest number of moves for a n disks tower ?

Episode 18 – The Tower of Hanoi

(11)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

(12)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

If the number of disks is even, start by moving the smallest disk to the intermediary post.

Episode 18 – The Tower of Hanoi

(13)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

If the number of disks is even, start by moving the smallest disk to the intermediary post.

Then, alternate moves between the smallest piece and a non-smallest piece.

(14)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

If the number of disks is even, start by moving the smallest disk to the intermediary post.

Then, alternate moves between the smallest piece and a non-smallest piece.

When moving the smallest piece, always move it in the same direction (either to the left or to the right, according to your first move, but be consistent).

Episode 18 – The Tower of Hanoi

(15)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

If the number of disks is even, start by moving the smallest disk to the intermediary post.

Then, alternate moves between the smallest piece and a non-smallest piece.

When moving the smallest piece, always move it in the same direction (either to the left or to the right, according to your first move, but be consistent).

If there is no tower in the chosen direction, move it to the opposite end.

(16)

The algorithm

If the number of disks is odd, start by moving the smallest disk to the destination post.

If the number of disks is even, start by moving the smallest disk to the intermediary post.

Then, alternate moves between the smallest piece and a non-smallest piece.

When moving the smallest piece, always move it in the same direction (either to the left or to the right, according to your first move, but be consistent).

If there is no tower in the chosen direction, move it to the opposite end.

When the turn is to move the non-smallest piece, there is only one legal move.

Episode 18 – The Tower of Hanoi

(17)

The lowest number of moves

Theorem

The lowest number of moves necessary to move a n disks tower is 2n1.

(18)

The lowest number of moves : a proof

Proof.

Let’s prove this result by induction.

Episode 18 – The Tower of Hanoi

(19)

The lowest number of moves : a proof

Proof.

Let’s prove this result by induction.

Basis : First, consider the 1-disk situation. Then, the lowest number of moves is obviously 1=21−1, so the property is true.

(20)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k .

Episode 18 – The Tower of Hanoi

(21)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower.

(22)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post,

Episode 18 – The Tower of Hanoi

(23)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post, then move the largest disk to the destination post,

(24)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post, then move the largest disk to the destination post, then move the k disks tower from the intermediary post to the destination post.

Episode 18 – The Tower of Hanoi

(25)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post, then move the largest disk to the destination post, then move the k disks tower from the intermediary post to the destination post. According to our induction hypothesis, the total number of moves for this procedure is

(2k −1) +1+ (2k −1) =2×2k−1=2k+1−1.

(26)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post, then move the largest disk to the destination post, then move the k disks tower from the intermediary post to the destination post. According to our induction hypothesis, the total number of moves for this procedure is

(2k −1) +1+ (2k −1) =2×2k−1=2k+1−1.

So the property is true for the k+1 disks tower.

Episode 18 – The Tower of Hanoi

(27)

The lowest number of moves : a proof

Proof.

Inductive step : Then, suppose that we have proved the lowest number of moves needed to move a k disks tower is 2k, for a natural number k . Let’s look at the k+1 disks tower. To move it to the destination post, we must first move the k disks at the top of the tower to the intermediary post, then move the largest disk to the destination post, then move the k disks tower from the intermediary post to the destination post. According to our induction hypothesis, the total number of moves for this procedure is

(2k −1) +1+ (2k −1) =2×2k−1=2k+1−1.

(28)

The lowest number of moves : a proof

Proof.

Conclusion : Since both the basis and the inductive step have been proved, it has now been proved by mathematical induction that the property holds for all natural n.

Episode 18 – The Tower of Hanoi

Références

Documents relatifs

If the closure of the case has been agreed with the manager of the Territory Unit or senior social worker, under the supervision of whom social worker performs, by defining the cause

The monument - the tourist attraction - passes, materially and symbolically, to the background; the foreground being occupied by the tourist, who is the true

The harmonics caused by the switching of the power conversion devices are the main factor-causing problems to sensitive equipment or the connected loads,

57.7 and 57.17 : “The following collective rights of indigenous communes, communities, peoples, and nations are recognized and guaranteed, in accordance with the Constitution

confidential to say, he wrote it in cipher, that is, by so changing the order of the letters of the alphabet, that not a word could be made out.. If anyone wishes to decipher these,

Abe Slaney Sherlock Holmes

Thomas Beale visits Robert Morriss and stays at his hotel for a few months from January 1820.... Act 2

The following proedure yields the lowest possible number of moves to move any number of disks from. the rst post to