the tower of hanoi

87
The Tower of Hanoi Edouard Lucas (1884) Probably In the temple of Banares, says he, beneath the dome which marks the centre of the World, rests a brass plate in which are placed 3 diamond needles, each a cubit high and as thick as the body of a bee. On one of these needles, at the creation, god placed 64 discs of pure gold, the largest disc resting on the brass plate and the others getting smaller and smaller up to the top one. This is the tower of brahma. Day and night unceasingly the priests transfer the discs from one diamond needle to another according to the fixed and immutable laws of brahma, which require that the priest on duty must not move more than one disc at a time and that he must place this disc on a needle so that there is no smaller disc below it. When the 64 discs shall have been thus transferred from the needle on which at the creation god placed them to one of the other needles, tower, temple and Brahmans

Upload: wilson

Post on 07-Jan-2016

26 views

Category:

Documents


1 download

DESCRIPTION

The Tower of Hanoi. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: The Tower of Hanoi

The Tower of Hanoi

Edouard Lucas (1884) Probably

In the temple of Banares, says he, beneath the dome which marks the centre of the World, rests a brass plate

in which are placed 3 diamond needles, each a cubit high and as thick as the body of a bee. On one of these

needles, at the creation, god placed 64 discs of pure gold, the largest disc resting on the brass plate and the

others getting smaller and smaller up to the top one. This is the tower of brahma. Day and night unceasingly the priests transfer the discs from one diamond needle to another according to the fixed and immutable laws of

brahma, which require that the priest on duty must not move more than one disc at a time and that he must place this disc on a needle so that there is no smaller disc below it. When the 64 discs shall have been thus

transferred from the needle on which at the creation god placed them to one of the other needles, tower, temple and Brahmans alike will crumble into dust and with a

thunder clap the world will vanish.

Page 2: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Illegal Move

Page 3: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 4: The Tower of Hanoi

Demo 3 tower

The Tower of Hanoi

A B C

3 Tower

Page 5: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 6: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 7: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 8: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 9: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 10: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

Page 11: The Tower of Hanoi

The Tower of Hanoi

A B C

3 Tower

7 Moves

Page 12: The Tower of Hanoi

The Tower of Hanoi•Confirm that you can move a 3 tower to another peg in a minimum of 7 moves.

•Investigate the minimum number of moves required to move different sized towers to another peg.

•Try to devise a recording system that helps you keep track of the position of the discs in each tower.

•Try to get a feel for how the individual discs move. A good way to start is to learn how to move a 3 tower from any peg to another of your choice in the minimum number of 7 moves.

•Record moves for each tower, tabulate results look for patterns make predictions (conjecture) about the minimum number of moves for larger towers, 8, 9, 10,……64 discs. Justification is needed.

•How many moves for n disks?Investigation

Page 13: The Tower of Hanoi

4 Tower show

The Tower of Hanoi

A B C

4 Tower

Page 14: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 15: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 16: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 17: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 18: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 19: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 20: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 21: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 22: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 23: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 24: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 25: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 26: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 27: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

Page 28: The Tower of Hanoi

The Tower of Hanoi

A B C

4 Tower

15 Moves

Page 29: The Tower of Hanoi

5 Tower show

The Tower of Hanoi

A B C

5 Tower

Page 30: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 31: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 32: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 33: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 34: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 35: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 36: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 37: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 38: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 39: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 40: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 41: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 42: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 43: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 44: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 45: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 46: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 47: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 48: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 49: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 50: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 51: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 52: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 53: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 54: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 55: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 56: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 57: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 58: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 59: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

Page 60: The Tower of Hanoi

The Tower of Hanoi

A B C

5 Tower

31 Moves

Page 61: The Tower of Hanoi

1

3

7

15

31

63

127

255

Results Table

?

The Tower of HanoiDiscs

1

Moves

2

3

4

5

6

7

8

64

n ?

}Un = 2Un-1 + 1This is called a

recursive function.

2n - 1

264 -1

Why does it happen?

How long would it take at a rate of 1 disc/second?

Can you find a way to write this indexed number out in full?

Page 62: The Tower of Hanoi

Can you use your calculator and knowledge of the laws of indices to work out 264?

264 = 232 x 232

2 5 7 6 9 8 0 3 7 7 6

3 8 6 5 4 7 0 5 6 6 4 0

8 5 8 9 9 3 4 5 9 2 0 0

3 0 0 6 4 7 7 1 0 7 2 0 0 0

2 5 7 6 9 8 0 3 7 7 6 0 0 0 0

3 8 6 5 4 7 0 5 6 6 4 0 0 0 0 0

1 7 1 7 9 8 6 9 1 8 4 0 0 0 0 0 0

3 8 6 5 4 7 0 5 6 6 4 0 0 0 0 0 0 08 5 8 9 9 3 4 5 9 2 0 0 0 0 0 0 0 0

1 7 1 7 9 8 6 9 1 8 4 0 0 0 0 0 0 0 0 0

x42949672964294967296

1 8 4 4 6 7 4 4 0 7 3 7 0 9 5 5 1 6 1 6

264 – 1 = 5

Page 63: The Tower of Hanoi

MillionsBillions

Trillions

1 8 4 4 6 7 4 4 0 7 3 7 0 9 5 5 1 6 1 5

Moves needed to transfer all 64 discs.

How long would it take if 1 disc/second was moved?

585 000 000 000 years

The age of the Universe is currently put at between 15 and 20 000 000 000 years.

64112 1

5.85 10 years(60 60 24 365)

xx x x

Seconds in a year.

Page 64: The Tower of Hanoi

Results Table

The Tower of Hanoi

Un = 2Un-1 + 1

This is called a recursive function.1

3

7

15

31

63

127

255

Discs

1

Moves

2

3

4

5

6

7

8

n 2n - 1

We can never be absolutely certain that the minimum number of moves m(n) = 2n – 1 unless we prove it. How do we know for sure that the rule will not fail at some future value of n? If it did then this would be a counter example to the rule and would disprove it.

The proof depends first on proving that the recursive function above is true for all n. Then using a technique called mathematical induction. This is quite a difficult type of proof to learn so I have decided to leave it out. There is nothing stopping you researching it though if you are interested.

Page 65: The Tower of Hanoi

n

5

4

3

2

RegionsPoints1

2

3

45

2

4

8

16

66 31

2n-1

A counter example!

Page 66: The Tower of Hanoi

Histori

cal Note

Historical Note

The Tower of Hanoi was invented by the French mathematician Edouard Lucas and sold as a toy in 1883. It originally bore the name of”Prof.Claus” of the college of “Li-Sou-Stain”, but these were soon discovered to be anagrams for “Prof.Lucas” of the college of “Saint Loius”, the university where he worked in Paris.

Edouard Lucas (1842-1891)

Lucas studied the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21,… (named after the medieval mathematician, Leonardo of Pisa). Lucas may have been the first person to derive the famous formula for the nth term of this sequence involving the Golden Ratio: 1.61803… ½(1 + 5).

Lucas also has his own related sequence named after him: 2,1,3,4,7,11,… He went on to devise methods for testing the primality of large numbers and in 1876 he proved that the Mersenne number 2127 – 1 was prime. This remains the largest prime ever found without the aid of a computer.

(1180-1250)

(1 5) (1 5)

2 5

n n

n nF

2127 – 1 = 170,141,183,460,469,231,731,687,303,715,884,105,727

Lucas/Binet formula

Page 67: The Tower of Hanoi

Kings Chessboard

According to an old legend King Shirham of India wanted to reward his servant Sissa Ban Dahir for inventing and presenting him with the game of chess. The desire of his servant seemed very modest: “Give me a grain of wheat to put on the first square of this chessboard, and two grains to put on the second square, and four grains to put on the third, and eight grains to put on the fourth and so on, doubling for each successive square, give me enough grain to cover all 64 squares.”

“You don’t ask for much, oh my faithful servant” exclaimed the king. Your wish will certainly be granted.

Based on an extract from “One, Two, Three…Infinity, Dover Publications.

The King’s Chessboard

Page 68: The Tower of Hanoi

1

2

4

8

16

32

64

2n-1

1

2

3

4

5

6

7

nth

How many grains of wheat are on the chessboard?

The sum of all the grains is: Sn= 20 + 21 + 22 + 23 + ………….+ 2n-2 + 2n-1We need a formula for the sum of this Geometric series.

If Sn= 20 + 21 + 22 + 23 + ………….+ 2n-2 + 2n-1

2Sn= ?

21 + 22 + 23 + 24 + ………….+ 2n-

1 + 2n2Sn – Sn= ?2n - 20

Sn= 2n - 1

264 - 1

The King has a

problem.

Page 69: The Tower of Hanoi

1 000 0001 = 1 000 000 = 106

1 000 0003 = 1 000 000 000 000 000 000 = 1018

1 000 0004 = 1 000 000 000 000 000 000 000 000 = 1024

1 000 0005 = 1 000 000 000 000 000 000 000 000 000 000 = 1030

1 000 0006 = 1036

Reading Large Numbers

The numbers given below are the original (British) definitions which are based on powers of a thousand. They are easier to remember however if you write them as powers of a million. They are mostly obsolete these days as the American definitions (smaller) apply in most cases.

Million

Billion*

Trillion

Quadrillion

Quintillion

Sextillion

Septillion 1 000 0007 = 1042

1 000 0002 = 1000 000 000 000 = 1012 (American Trillion)

* The American billion is = 1 000 000 000 and is the one in common usage. A world population of 6.4 billion means 6 400 000 000.

100

100

10

10

10

Googol

Googolplex

Upper limit of a

scientific calculator.

Large numbers

Page 70: The Tower of Hanoi

MBTQQS

One hundred and seventy sextillion,

one hundred and forty one thousand, one hundred and eighty three quintillion,

four hundred and sixty thousand, four hundred and sixty nine quadrillion,

two hundred and thirty one thousand, seven hundred and thirty one trillion,

six hundred and eighty seven thousand, three hundred and three billion,

seven hundred and fifteen thousand, eight hundred and eighty four million,

one hundred and five thousand, seven hundred and twenty seven.

Edouard Lucas (1842-1891)

2127 – 1 = 170 141 183 460 469 231 731 687 303 715 884 105 727

Reading very large numbers

To read a very large number simply section off in groups of 6 from the right and apply Bi, Tri, Quad, Quint, Sext, etc.

Page 71: The Tower of Hanoi

41 183 460 385 231 191 687 317 716 884

Reading very large numbers

To read a very large number simply section off in groups of 6 from the right and apply Bi, Tri, Quad, Quint, Sext, etc.

Try some of these

57 786 765 432 167 876 564 875 432 897 675 432

9 412 675 987 453 256 645 321 786 765 786 444 329 576

678 876 543 786 543 987 579 953 237 896 764 345 675 876 453 231

MBTQ

MBTQQ

MBTQQS

MBTQQSS

Page 72: The Tower of Hanoi

10010Googol Upper limit

of a scientific

calculator.

How big is a Googol?

10 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000.

1 followed by 100 zeros

Google

The googol was introduced to the world by the American mathematician Edward Kasner (1878-1955). The story goes that when he asked his 8 year old nephew, Milton, what name he would like to give to a really large number, he replied “googol”. Kasner also defined the Googolplex as 10googol, that is 1 followed by a googol of zeros.

Do we need a number this large? Does it have any physical meaning?

Page 73: The Tower of Hanoi

10010Googol

How big is a Googol?

10 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000.

1 followed by 100 zeros

Google

We saw how big 264 was when we converted that many seconds to years: 585 000 000 000 years. What about a googol of seconds? Who many times bigger is a googol than 264? Use your scientific calculator to get an approximation.

10080

64

105.4 10

2x

80 11

92

5.4 10 5.85 10

3 10 years.

So x x x

x

Page 74: The Tower of Hanoi

Earth Mass = 5.98 x 1027 g

Hydrogen atom Mass = 1.67 x 10-

24g

10010Googol Upper limit

of a scientific

calculator.

How big is a Googol?

10 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000 000. Supposing that the Earth was

composed solely of the lightest of all atoms (Hydrogen), how many would be contained within the planet?

2751

24

5.98 103.58 10

1.67 10x

x Googolx

The total number of a atoms in the universe has been estimated at 1080.

Page 75: The Tower of Hanoi

Is there a quantity as large as a Googol?

1 1 2 3 1 2 3 41 2Find all possible arrangements for the sets of numbered cards below.

1 1, 2

2, 1

3, 1, 2

1, 3, 21, 2, 3

3, 2, 1

2, 3, 1

2, 1, 3

4, 3, 1, 2

3, 4, 1, 2

3, 1, 4, 2

3, 1, 2, 4

4, 1, 3, 2

1, 4, 3, 2

1, 3, 4, 21, 3, 2, 4

4, 1, 2, 3

1, 4, 2, 3

1, 2, 4, 3

1, 2, 3, 4

4, 3, 2, 1

3, 4, 2, 1

3, 2, 4, 13, 2, 1, 4

4, 2, 3, 1

2, 4, 3, 1

2, 3, 4, 1

2, 3, 1, 4

4, 2, 1, 3

2, 4, 1, 3

2, 1, 4, 3

2, 1, 3, 4

1

2

6

24What about if 5 is introduced.Can you see what will happen?

1 2 3 4 5120

Can you write the number of arrangements as a product of successive integers?

Objectsarrangemen

ts n!

1 1 1

2 2 2 x 1

3 6 3 x 2 x 1

4 24 4 x 3 x 2 x 1

5 120 5 x 4 x 3 x 2 x 1

n! is read as n factorial).

Factorials

Page 76: The Tower of Hanoi

Is there a quantity as large as a Googol?

The number of possible arrangements of a set of n objects is given by n! (n factorial). As the number of objects increase the number of arrangements grows very rapidly.

How many arrangements are there for the books on this shelf?

8! = 40 320

How many arrangements are there for a suit in a deck of cards?

13! = 6 227 020 800

Page 77: The Tower of Hanoi

Is there a quantity as large as a Googol?

The number of possible arrangements of a set of n objects is given by n!.(n factorial) As the number of objects increases the number of arrangements grows very rapidly.

26! = 4 x 1026

16! = 2.1 x 1013

How many arrangements are there for the letters of the Alphabet?

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

How many arrangements are there for placing the numbers 1 to 16 in the grid?

16

3 2 135 1

011

8

9 6 7 124 1

514

1

Page 78: The Tower of Hanoi

Find other factorial values on your calculator. What is the largest value that the calculator can display?

70! 10100 = Googol

20! 2.4 x 1018

30! 2.7 x 1032

40! 8.2 x 1047

50! 3.0 x 1064

60! 8.3 x 1081

69! 1.7 x 1098

70! Error

52! 8.1 x 1067

So although a googol of physical objects does not exist, if you hold 70 numbered cards in your hand you could theoretically arrange them in a googol number of ways. (An infinite amount of time of course would be needed).

Is there a quantity as large as a Googol?

The number of possible arrangements of a set of n objects is given by n!.(n factorial) As the number of objects increases the number of arrangements grows very rapidly.

Page 79: The Tower of Hanoi

2

3

6

12

18

24

30

10

10

10

10

10

10

10

10 1 with a 100 zeros (a googol)

10 1 with a 1000 zeros

10 1 with a 1 000 000 zeros

10 1 with a 1 billion zeros

10 1 with a 1 trillion zeros

10 1 with a quadrillion zeros

10 1 with

36

42

100

10

10

10

a quintillion zeros

10 1 with a sextilion zeros

10 1 with a septilion zeros

10 1 with a googol zeros

The table shown gives you a feel for how truly unimaginable this number is!

What about a Googolplex?

10010 10 10googolA Googolplex A number so big that it can never be written out in full! There isn’t enough ink,time or paper.

Googolplex

Page 80: The Tower of Hanoi

And Finally

Page 81: The Tower of Hanoi

1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000………………….

2000 digits on a page.

10010 100 10 1 10 .A Googolplex followed by zeros

How many pages needed?

100

39610

2 10

5 10Pages neede xdx

The End!

Page 82: The Tower of Hanoi

The Tower of HanoiIn the temple of Banares, says he, beneath the dome

which marks the centre of the World, rests a brass plate in which are placed 3 diamond needles, each a cubit high

and as thick as the body of a bee. On one of these needles, at the creation, god placed 64 discs of pure

gold, the largest disc resting on the brass plate and the others getting smaller and smaller up to the top one. This

is the tower of brahma. Day and night unceasingly the priests transfer the discs from one diamond needle to another according to the fixed and immutable laws of

brahma, which require that the priest on duty must not move more than one disc at a time and that he must place this disc on a needle so that there is no smaller disc below it. When the 64 discs shall have been thus

transferred from the needle on which at the creation god placed them to one of the other needles, tower, temple and Brahmans alike will crumble into dust and with a

thunder clap the world will vanish.Worksheets

Page 83: The Tower of Hanoi

A B C

The Tower of Hanoi

Page 84: The Tower of Hanoi
Page 85: The Tower of Hanoi

•Confirm that you can move a 3 tower to another peg in a minimum of 7 moves.

•Investigate the minimum number of moves required to move different sized towers to another peg.

•Try to devise a recording system that helps you keep track of the position of the discs in each tower.

•Try to get a feel for how the individual discs move. A good way to start is to learn how to move a 3 tower from any peg to another of your choice in the minimum number of 7 moves.

•Record moves for each tower, tabulate results look for patterns make predictions (conjecture) about the minimum number of moves for larger towers, 8, 9, 10,……64 discs. Justification is needed.

•How many moves for n disks?

Tower of Hanoi

Page 86: The Tower of Hanoi

n

5

4

3

2

RegionsPoints1

2

3

45

Page 87: The Tower of Hanoi

41 183 460 385 231 191 687 317 716 884

Reading very large numbers

To read a very large number simply section off in groups of 6 from the right and apply Bi, Tri, Quad, Quint, Sext, etc.

Try some of these

57 786 765 432 167 876 564 875 432 897 675 432

9 412 675 987 453 256 645 321 786 765 786 444 329 576

678 876 543 786 543 987 579 953 237 896 764 345 675 876 453 231