The Tower of Hanoi Myths and Maths
The Tower of Hanoi Myths and Maths
Mathematics Subject Classification: 00-02, 01A99, 05-03, 05A99, 05Cxx, 05E18, 11Bxx, 11K55,
11Y55, 20B25, 28A80, 54E35, 68Q25, 68R05, 68T20, 91A46, 91E10, 94B25, 97A20
by Ian Stewart
I know when I first came across the Tower of Hanoi because I still have a copy
of the book that I found it in: Riddles in Mathematics by Eugene P. Northrop,
first published in 1944. My copy, bought in 1960 when I was fourteen years old,
was a Penguin reprint. I devoured the book, and copied the ideas that especially
intrigued me into a notebook, alongside other mathematical oddities. About a
hundred pages further into Northrop’s book I found another mathematical oddity:
Wacław Sierpiński’s example of a curve that crosses itself at every point. That,
too, went into the notebook.
It took nearly thirty years for me to become aware that these two curious
structures are intimately related, and another year to discover that several others
had already spotted the connection. At the time, I was writing the monthly column
on mathematical recreations for Scientific American, following in the footsteps of
the inimitable Martin Gardner. In fact, I was the fourth person to write the column.
Gardner had featured the Tower of Hanoi, of course; for instance, it appears in his
book Mathematical Puzzles and Diversions.
Seeking a topic for the column, I decided to revisit an old favourite, and
started rethinking what I knew about the Tower of Hanoi. By then I was aware
that the mathematical essence of many puzzles of that general kind—rearranging
objects according to fixed rules—can often be understood using the state diagram.
This is a network whose nodes represent possible states of the puzzle and whose
edges correspond to permissible moves. I wondered what the state diagram of the
Tower of Hanoi looked like. I probably should have thought about the structure
of the puzzle, which is recursive. To solve it, forget the bottom disc, move the
remaining ones to an empty peg (the same puzzle with one disc fewer), move the
bottom disc, and put the rest back on top. So the solution for, say, five discs
reduces to that for four, which in turn reduces to that for three, then two, then
one, then zero. But with no discs at all, the puzzle is trivial.
vi Foreword
Instead of thinking, I wrote down all possible states for the Tower of Hanoi
with three discs, listed the legal moves, and drew the diagram. It was a bit messy,
but after some rearrangement it suddenly took on an elegant shape. In fact, it
looked remarkably like one of the stages in the construction of Sierpiński’s curve.
This couldn’t possibly be coincidence, and once I’d noticed this remarkable resem-
blance, it was then straightforward to work out where it came from: the recursive
structure of the puzzle.
Several other people had already noticed this fact independently. But shortly
after my rediscovery I was in Kyoto at the International Congress of Mathemati-
cians. Andreas Hinz introduced himself and told me that he had used the con-
nection with the Tower of Hanoi to calculate the average distance between any
two points of Sierpiński’s curve. It is precisely 466/885 of the diameter. This is
an extraordinary result—a rational number, but a fairly complicated one, and far
from obvious.
This wonderful calculation is just one of the innumerable treasures in this
fascinating book. It starts with the best account I have ever read of the history
of the puzzle and its intriguing relatives. It investigates the mathematics of the
puzzle and discusses a number of variations on the Tower of Hanoi theme. And
to drive home how even the simplest of mathematical concepts can propel us into
deep waters, it ends with a list of currently unsolved problems. The authors have
done an amazing job, and the world of recreational mathematics has a brilliant
new jewel in its crown.
Preface
The British mathematician Ian Stewart pointed out in [307, p. 89] that “Mathemat-
ics intrigues people for at least three different reasons: because it is fun, because it
is beautiful, or because it is useful.” Careful as mathematicians are, he wrote “at
least”, and we would like to add (at least) one other feature, namely “surprising”.
The Tower of Hanoi (TH) puzzle is a microcosmos of mathematics. It appears in
different forms as a recreational game, thus fulfilling the fun aspect; it shows rela-
tions to Indian verses and Italian mosaics via its beautiful pictorial representation
as an esthetic graph, it has found practical applications in psychological tests and
its theory is linked with technical codes and phenomena in physics.
The authors are in particular amazed by numerous popular and professional
(mathematical) books that display the puzzle on their covers. However, most of
these books discuss only well-established basic results on the TH with incomplete
arguments. On the other hand, in the last decades the TH became an object of
numerous—some of them quite deep—investigations in mathematics, computer
science, and neuropsychology, to mention just central scientific fields of interest.
The authors have acted frequently as reviewers for submitted manuscripts on
topics related to the TH and noted a lack of awareness of existing literature and
a jumble of notation—we are tempted to talk about a Tower of Babel! We hope
that this book can serve as a base for future research using a somewhat unified
language.
More serious were the errors or mathematical myths appearing in manuscripts
and even published papers (which did not go through our hands). Some “obvious
assumptions” turned out to be questionable or simply wrong. Here is where many
mathematical surprises will show up. Also astonishing are examples of how the
mathematical model of a difficult puzzle, like the Chinese rings, can turn its so-
lution into a triviality. A central theme of our book, however, is the meanwhile
notorious Frame-Stewart conjecture, a claim of optimality of a certain solution
strategy for what has been called The Reve’s puzzle. Despite many attempts and
even allegations of proofs, this has been an open problem for more than 70 years.
Apart from describing the state of the art of its mathematical theory and
applications, we will also present the historical development of the TH from its
invention in the 19th century by the French number theorist Édouard Lucas. Al-
though we are not professional historians of science, we nevertheless take historical
viii Preface
remarks and comments seriously. During our research we encountered many errors
or historical myths in literature, mainly stemming from the authors copying state-
ments from other authors. We therefore looked into original sources whenever we
could get hold of them.
Our guideline for citing other authors’ papers was to include “the first and
the best” (if these were two). The first, of course, means the first to our current
state of knowledge, and the best means the best to our (current) taste.
This book is also intended to render homage to Édouard Lucas and one of his
favorite themes, namely recreational mathematics in their role in mathematical
education. The historical fact that games and puzzles in general and the TH
in particular have demonstrated their utility is universally recognized (see, e.g.,
[295, 123]) more than 100 years after Lucas’s highly praised book series started
with [209].
Myths
Along the way we deal with numerous myths that have been created since the
puzzle appeared on the market in 1883. These myths include mathematical mis-
conceptions which turned out to be quite persistent, despite the fact that with
a mathematically adequate approach it is not hard to clarify them entirely. A
particular goal of this book is henceforth to act as a myth buster.
Prerequisites
A book of this size can not be fully self-contained. Therefore we assume some
basic mathematical skills and do not explain fundamental concepts such as sets,
sequences or functions, for which we refer the reader to standard textbooks like
[107, 284, 26]. Special technical knowledge of any mathematical field is not nec-
essary, however. Central topics of discrete mathematics, namely combinatorics,
graph theory, and algorithmics are covered, for instance, in [197, 36], [336, 41, 72],
and [179, 231], respectively. However, we will not follow notational conventions
of any of these strictly, but provide some definitions in a glossary at the end of
the book. Each term appearing in the glossary is put in bold face when it occurs
for the first time in the text. This is mostly done in Chapter 0, which serves as
a gentle introduction to ideas, concepts and notation of the central themes of the
book. This chapter is written rather informally, but the reader should not be dis-
couraged when encountering difficult passages in later chapters, because they will
be followed by easier parts throughout the book.
The reader must also not be afraid of mathematical formulas. They shape the
language of science, and some statements can only be expressed unambiguously
when expressed in symbols. In a book of this size the finiteness of the number
of symbols like letters and signs is a real limitation. Even if capitals and lower
case, Greek and Roman characters are employed, we eventually run out of them.
Therefore, in order to keep the resort to indices moderate, we re-use letters for
Preface ix
sometimes quite different objects. Although a number of these are kept rather
stable globally, like n for the number of discs in the TH or names of special
sequences like Gros’s g, many will only denote the same thing locally, e.g., in a
section. We hope that this will not cause too much confusion. In case of doubt we
refer to the indexes at the end of the book.
Algorithms
The TH has attracted the interest of computer scientists in recent decades, albeit
with a widespread lack of rigor. This poses another challenge to the mathematician
who was told by Donald Knuth in [178, p. 709] that “It has often been said that
a person doesn’t really understand something until he teaches it to someone else.
Actually a person doesn’t really understand something until he can teach it to
a computer, i.e. express it as an algorithm.” We will therefore provide provably
correct algorithms throughout the chapters. Algorithms are also crucial for human
problem solvers, differing from those directed to machines by the general human
deficiency of a limited memory.
Exercises
Édouard Lucas begins his masterpiece “Théorie des nombres” [213, iii] with a
(slightly corrected) citation from a letter of Carl Friedrich Gauss to Sophie Ger-
main dated 30 April 1807 (“jour de ma naissance”): “Le goût pour les sciences
abstraites, en général, et surtout pour les mystères des nombres, est fort rare;
on ne s’en étonne pas. Les charmes enchanteurs de cette sublime science ne se
décèlent dans toute leur beauté qu’à ceux qui ont le courage de l’approfondir.” 1
Sad as it is that the first sentence is still true after more than 200 years, the
second sentence, as applied to all of mathematics, will always be true. Just as it
is impossible to get an authentic impression of what it means to stand on top of
a sizeable mountain from reading a book on mountaineering without taking the
effort to climb up oneself, a mathematics book has always to be read with paper
and pencil in reach. The readers of our book are advised to solve the excercises
posed throughout the chapters. They give additional insights into the topic, fill
missing details, and challenge our skills. All exercises are addressed in the body of
the text. They are of different grades of difficulty, but should be treatable at the
place where they are cited. At least, they should then be read, because they may
also contain new definitions and statements needed in the sequel. We collect hints
and solutions to the problems at the end of the book, because we think that the
reader has the right to know that the writers were able to solve them.
1
“The taste for abstract sciences, in general, and in particular for the mysteries of numbers,
is very rare; this doesn’t come as a surprise. The enchanting charms of that sublime science do
not disclose themselves in all their beauty but to those who have the courage to delve into it.”
x Preface
Contents
The book is organized into ten chapters. As already mentioned, Chapter 0 intro-
duces the central themes of the book and describes related historical developments.
Chapter 1 is concerned with the Chinese rings puzzle. It is interesting in its own
right and leads to a mathematical model that is a prototype for an approach to
analyzing the TH. The subsequent chapter studies the classical TH with three
pegs. The most general problem solved in this chapter is how to find an opti-
mal sequence of moves to reach an arbitrary regular state from another regular
state. An important subproblem solved is whether the largest disc moves once or
twice (or not at all). Then, in Chapter 3, we further generalize the task to reach
a given regular state from an irregular one. The basic tool for our investigations
is a class of graphs that we call Hanoi graphs. A variant of these, the so-called
Sierpiński graphs, is introduced in Chapter 4 as a new and useful approach to
Hanoi problems.
The second part of the book, starting from Chapter 5, can be understood
as a study of variants of the TH. We begin with the famous The Reve’s puzzle
and, more generally, the TH with more than three pegs. The central role is played
by the notorious Frame-Stewart conjecture which has been open since 1941. Very
recent computer experiments are also described that further indicate the inherent
difficulty of the problem. We continue with a chapter in which we formally discuss
the meaning of the notion of a variant of the TH. Among the variants treated
we point out the Tower of Antwerpen and the Bottleneck TH. A special chapter
is devoted to the Tower of London, invented in 1982 by T. Shallice, which has
received an astonishing amount of attention in the psychology of problem solving
and in neuropsychology, but which also gives rise to some deep mathematical
statements about the corresponding London graphs. Chapter 8 treats TH type
puzzles with oriented disc moves, variants which, together with the more-pegs
versions, have received the broadest attention in mathematics literature among all
TH variants studied.
In the final chapter we recapitulate open problems and conjectures encoun-
tered in the book in order to provide stimulation for those who want to pass their
time expediently waiting for some Brahmins to finish a divine task.
Educational aims
With an appropriate selection from the material, the book is suitable as a text for
courses at the undergraduate or graduate level. We believe that it is also a con-
venient accompaniment to mathematical circles. The numerous exercises should
be useful for these purposes. Themes from the book have been employed by the
authors as a leitmotif for courses in discrete mathematics, specifically by A. M. H.
at the LMU Munich and in block courses at the University of Maribor and by S. K.
at the University of Ljubljana. The playful nature of the subject lends itself to pre-
sentations of the fundamentals of mathematical thinking for a general audience.
Preface xi
The TH was also at the base of numerous research programs for gifted students.
The contents of this book should, and we hope will, initiate further activities of
this sort.
Feedback
If you find errors or misleading formulations, please send a note to the authors.
Errata, sample implementations of algorithms, and other useful information will
appear on the TH-book website at http://tohbook.info.
Acknowledgements
We are indebted to many colleagues and students who read parts of the book,
gave useful remarks or kept us informed about very recent developments and to
those who provided technical support. Especially we thank Jean-Paul Allouche,
Jens-P. Bode, Drago Bokal, Christian Clason, Adrian Danek, Yefim Dinitz, Menso
Folkerts, Rudolf Fritsch, Florence Gauzy, Katharina A. M. Götz, Andreas Groh,
Robert E. Jamison, Marko Petkovšek, Amir Sapir, Marco Schwarz, Walter Spann,
Arthur Spitzer, Sebastian Strohhäcker, Karin Wales, and Sara Sabrina Zemljič.
Throughout the years we particularly received input and advice from Simon
Aumann, Daniele Parisse, David Singmaster, and Paul Stockmeyer (whose “list”
[313] has been a very fruitful source).
Original photos were generously supplied by James Dalgety (The Puzzle Mu-
seum) and by Peter Rasmussen and Wei Zhang (Yi Zhi Tang Collection). For
the copy of an important historical document we thank Claude Consigny (Cour
d’Appel de Lyon). We are grateful to the Cnam – Musée des arts et métiers (Paris)
for providing the photos of the original Tour d’Hanoï.
Special thanks go to the Birkhäuser/Springer Basel team. In particular, our
Publishing Editor Barbara Hellriegel and Managing Director Thomas Hempfling
guided us perfectly through all stages of the project for which we are utmost
grateful to them, while not forgetting all those whose work in the background has
made the book a reality.
A. M. H. wants to express his appreciation of the hospitality during his
numerous visits in Maribor.
Last, but not least, we all thank our families and friends for understanding,
patience, and support. We are especially grateful to Maja Klavžar, who, as a
librarian, suggested to us that it was about time to write a comprehensive and
widely accessible book on the Tower of Hanoi.
Preface vii
Glossary 293
Bibliography 297
The roots of mathematics go far back in history. To present the origins of the
protagonist of this book, we even have to return to the Creation.
which at the creation God placed them to one of the other needles, tower, temple,
and Brahmins alike will crumble into dust, and with a thunderclap the world will
vanish.”
Ball adds: “Would that English writers were in the habit of inventing
equally interesting origins for the puzzles they produce!”, a sentence censored by
H. S. M. Coxeter in his revised edition of Ball’s classic [24, p. 304].
As with all myths, Claus’s legend underwent metamorphoses: the decoration
of the discs [étages] with diamonds from Golconda1 transformed into diamond
needles, de Parville put the great temple of Benares2 to the center of the world
and moved “since quite a long time” to “the beginning of the centuries”, which Ball
interprets as the creation. As if the end of the world would not be dramatic enough,
Ball adds a “thunderclap” to it. So the Tower of Brahma became a time-spanning
riddle. Apart from his strange spelling of the Hindu god, Ball also re-formulated
the rule which de Parville enunciated as “he must not place that disc but on
an empty needle or above [au-dessus de] a larger disc”. More importantly, while
de Parville insists in the task to transport the tower from the first to the third
needle, Ball’s Bramah did not specify the goal needle; we will see that this makes
a difference!
In another early account, the Dutch mathematician P. H. Schoute is more
precise by insisting to put the disc (or ring in his diction) “on an empty [needle] or
on a larger [disc]” [286, p. 275] and specifying the goal by alluding to the Hindu
triad of the gods Brahma, Vishnu, and Shiva: Brahma, the creator, placed the discs
on the first needle and when they all reach Shiva’s, the world will be destroyed;
in between, it is sustained by the presence of Vishnu’s needle. The latter god will
also watch over the observance of what we will call the (cf. [215, p. 55])
divine rule: you must not place a disc on a smaller one.
Let us hope that Sarasvati, Brahma’s consort and the goddess of learning, will
guide us through the mathematical exploration of the fascinating story of the
sacred tower!
Among the many variants of the story, which would fill a book on its own,
let us only mention the reference to “an Oriental temple” by F. Schuh [288, p. 95]
where 100 alabaster discs were waiting to be transferred by believers from one of
two silver pillars to the only golden one. Quite obviously, Schoute’s compatriot
was more in favor of the decimal system than the Siamese inventor of the puzzle,
who, almost by definition, preferred base two.
De Parville, in his short account of what came to be known as the Tower of
Hanoi (TH), was also very keen in identifying this man from Indochina. A man-
darin, says he, who invents a game based on combinations, will incessantly think
about combinations, see and implement them everywhere. As one is never betrayed
but by oneself, permuting the letters of the signatory of the TH, N. Claus (de
1
at the time the most important market for diamonds, located near the modern city of
Hyderabad
2
today’s Vārānası̄
0.1. The Legend of the Tower of Brahma 3
Siam), mandarin of the collège Li-Sou-Stian will reveal Lucas d’Amiens, teacher
at the lycée Saint-Louis.
François Édouard Anatole Lucas (see Figure 0.1) was born on 4 April 1842 in
the French city of Amiens and worked the later part of his short life at schools in
Paris. Apart from being an emminent number theorist, he published, from 1882,
3
Throughout we cite editions which were at our disposition.
4 Chapter 0. The Beginning of the World
The legends emerging from this long tradition are mostly frivolous in character,
reporting from a Chinese hero who gave the puzzle to his wife when he was leav-
ing for war, for the obvious motive of “entertaining” her during his absence. The
present might have looked as in Figure 0.2.
The most serious attribution has been made by S. Culin in his ethnological
work on Eastern games [62, p. 31f]. According to his “Korean informant”, the caring
husband was Hung Ming, actually a real person (Zhuge Liang, 诸葛亮, 181–234).
However, the material currently available is also compatible with a European origin
of the game.
The earliest known evidence can be found in Chapter 107 of Luca Pacioli’s De
viribus quantitatis (cf. [250, p. 290–292]) of around 1500, where the physical object,
with a certain number of rings, is described and a method to get the rings onto the
bar is indicated. Pacioli speaks of a “difficult case”. A 7-ring version was discussed
in the middle of the 16th century in Book 15 of G. Cardano’s De subtilitate libri
XXI as a “useless” instrument (“Verùm nullius vsus est instrumétú ex septem
annulis...”) which embodies a game of “admirable subtlety” (“miræ subtilitatis”)
[50, p. 492f]. On the other hand, Cardano claimed that the ingenious mechanism
was not that useless at all and therefore employed in locks for chests, a claim
supported by Lucas in [214, p. 165, footnote]. The reader may consult [1] for more
myths.
Many names have been given to the Chinese rings over the centuries. They
have been called Delay guest instrument in Korea, Cardano’s rings or tiring irons
in England (Dudeney reports in 1917 that “it is said still to be found in obscure
English villages (sometimes deposited in strange places such as a church belfry)”;
cf. [79, Problem 417].), and Nürnberger Zankeisen (quarrel iron) in Germany, but
the most puzzling designation is the French baguenaudier. In the note [119] of the
Lyonnais barrister Louis Gros, almost 5 out of 16 text pages are devoted to the
etymology with the conclusion that it should be “baguenodier”, deriving from a
knot of rings. However, Lucas did not follow Gros’s arguments and so the French
name of a plant (Colutea arborescens) is still attached to the puzzle. But why then
has “baguenauder” in French the meaning of strolling around, wasting time?
0.2. History of the Chinese Rings 5
La tour d’Hanoï, —
Jeu de combinaison pour
appliquer le système de la numération
binaire, inventé par M. Edouard Lucas
(novembre 1883) — donné par l’auteur.
So we have a date of birth for the TH. (In [213, p. xxxii], Lucas claims that
the puzzle was published in 1882, but there is no evidence for that.) The idea of
the game was immediately pilfered around the world with patents approved, e.g.,
in the United States (No 303, 946 by A. Ohlert, 1884) and the United Kingdom
(No 20, 672 by A. Gartner and G. Talcott, 1890). In 1888, Lucas donated the
original puzzle (see Figures 0.4 and 0.5), together with a number of mechanical
calculating machines to the Conservatoire national des arts et métiers (Cnam) in
Paris, where he also gave public lectures for which a larger version of the TH was
produced; cf. [212].
The cover of the original box shows the fantastic scenery of Figure 0.6. The
picture, also published on 19 January 1884 in [59, p. 128], repeats all the allusions
to fancy names of places and persons we already found on the leaflet [58] which
accompanied the puzzle. Two details deserve to be looked at closer. The man
supporting the ten-storied pagoda has a tatoo on his belly: A U—Lucas was “agrégé
de l’université”, entitling him to teach at higher academic institutions. The crane,
a symbol for the Far East, holds a sheet of paper on which is written, with bamboo
leaves, the name Fo Hi—the former French transliteration of Fu Xi whom we met
before.
But why the name “The Tower of Hanoi”? We would not think of the capital
of today’s Vietnam in connection with Brahmins moving 64 golden discs in the
great temple of Benares. However, when Lucas started to market the puzzle in
its modest version with only eight wooden discs, French newspapers were full of
reports from Tonkin. In fact, Hanoi had been seized by the French in 1882, but
during the summer of 1883 was under constant siege by troops from the Chinese
province of Yunnan on the authority of the local court of Hué, where on 25 August
1883 the Harmand treaty established the rule of France over Annam and Tonkin
0.3. History of the Tower of Hanoi 7
(cf. [252, Section 11]). In [256], de Parville calls a variant of the TH, where discs
of increasing diameter were replaced by hollow pyramids of decreasing size, the
“Question of Tonkin” and comments the fact that the discs of Claus’s TH were
made of wood instead of gold as being more prudent because it concerns Tonkin.
So Lucas selected the name of Hanoi because it was in the headlines at the time.
Most probably, our book today would sell better had we chosen the title “The
Tower of Kabul”!
Lucas never travelled to Hanoi [210, p. 14]. However, he was a member of the
commission which edited the collected works of Pierre de Fermat and was sent on
a mission to Rome to search in the famous Boncompagni library for unpublished
papers of his illustrious compatriot (cf. [216, p. 91]). Was it on this voyage that Lu-
cas invented the TH? The leaflet, which we reproduce here as Figure 0.7, supports
this hypothesis when talking in a typical Lucas style about FER-FER-TAM-TAM,
thereby transforming the French government into a Chinese one.
10 Chapter 0. The Beginning of the World
Figure 0.7: Recto and verso of the leaflet accompanying the Tower of Hanoi puzzle
Apart from this, the front page of [58] discloses the motive of professor
N. Claus (de Siam) for his game, namely the vulgarization of science. He offers
enormous amounts of money for the person who solves, by hand, the TH with 64
discs and reveals the necessary number of displacements, namely
together with the claim that it would take more than five milliard4 centuries to
carry out the task making one move per second. The number in (0.1) is explained,
together with the rules of the game, which are imprecise concerning the goal peg
and redundant with respect to the divine rule, on the back of [58]. Here one can
find the famous recursive solution, stated for an arbitrary number of discs, but
demonstrated with an example: if one can solve the puzzle for eight discs, one can
solve it for nine by first transferring the upper eight to the spare peg, then moving
the ninth disc to the goal peg and finally the smaller ones to that peg too. So
by increasing the number of discs by one, the number of moves for the transfer
of the tower doubles plus one move of the largest disc. Now the superiority of
the binary number system becomes obvious. We write 2n for an n-fold product
of 2s, n ∈ N0 , e.g., 20 = 1 (by convention, the product of no factors is 1), 21 = 2,
4
billion, i.e. 109
0.3. History of the Tower of Hanoi 11
5
Some authors use this term only if k is prime.
12 Chapter 0. The Beginning of the World
Édouard Lucas (cf. [213, p. 3]). Its members Fk , the Fibonacci numbers (cf. [264]),
are given by the recurrence
Édouard Lucas died on 3 October 1891, aged only 49. His tomb, perpetual,
but in a deplorable condition, can be found on the Montmartre cemetary of Paris.
Upon his untimely death, Lucas left the second volume of his “Théorie des
nombres” [213] unfinished. E. T. Bell writes in 1951 [27, p. 230]: “Some years
ago the fantastic price of thirty thousand dollars was being asked for Lucas’s
manuscripts. In all his life Lucas never had that much money.” It is not known
where these manuscripts remained. The same fate happened to a collection of six
“Jeux scientifiques” (cf. [217, Note III]), for which Lucas earned two medals at the
World’s Fair in Paris in 1889 (the one for which another tower, namely Eiffel’s, was
erected). Some of these games are presented in Lucas’s article [211]. The puzzle
collection, dedicated to his children Paul and Madeleine, was advertised in Cosmos,
a scientific magazine, of 7 December 1889 as a first series, each single game being
sold by “Chambon & Baye” of Paris for the price of 10 francs. Among these was a
new version of the TH, this time with five pegs and 16 discs in four colors. He says
that the number of problems one can pose about the new TH is uncalculable. Five
of the brochures accompanying the puzzles are preserved, the only missing one is
about “Les Pavés florentin du père Sébastien”, also described in [22, p. 158]. Bell
suggested “His widely scattered writings should be collected, and his unpublished
manuscripts sifted and edited.” Despite some efforts (cf. [129, 18]), this goal is
still far from being reached. In particular, it would be desirable to review Lucas’s
œuvre in recreational mathematics just like Décaillot has done it for his work in
number theory.
For now we have to concentrate on Lucas’s greatest and most influential
invention. At the end of his account on the TH in [215, p. 58f], Lucas writes:
“Latterly, the foreign industry has taken possession of the game of our friend
[N. Claus (de Siam)] and of his legend; but we can assert that the whole had been
imagined, some time ago already [in 1876 according to [210, p. 14]], in no 56 of
rue Monge, in Paris, in the house built on the site of the one where Pascal died
on 19 August 1662.”
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
1 7 21 35 35 21 7 1
1 8 28 56 70 56 28 8 1
Figure 0.8: The Meru-Prastāra
combined to form a word of length k? Quite obviously (for us!), the answer is 2k ,
the number of bit strings of length k. But looking closer, how many combinations
of k syllables are there containing ` long and (consequently) k − ` short ones? The
answer is contained in Mount Meru by looking at the `th entry from the left in
the kth line from the top, both counting from 0. (It is a puzzle why almost all
presentations of AT start with the single 1 on top. Although the modern mathe-
matician is used to such abstruse things, how did the Ancients know that there is
precisely one way to choose no long syllable (and no short one either for that mat-
ter) to form an empty word?) This number will be pronounced “k choose `” and is
denoted by (k`). Summing the entries of a single line in Mount Meru immediately
leads to the formula
k
k
∀ k ∈ N0 ∶ ∑ ( ) = 2 k .
`=0 `
Another question that can be solved by looking at Mount Meru (cf. [161, p. 113f])
is the following: if long syllables take 2 beats (or morae), short ones only 1 beat
(mora), how many words (of varying lengths) can be formed from a fixed number
of m morae? Since m = 2`+k −` = k +`, this number can be found by summing over
all (k`) = (m−`
`
), i.e. some mounting diagonal in Mount Meru, with the astonishing
result that
m−`
⌊m ⌋
∀ m ∈ N0 ∶ ∑ ( ) = Fm+1 ,
2
(0.5)
`=0 `
where the floor function is defined for x ∈ R by ⌊x⌋ = max{a ∈ Z ∣ a ≤ x}. (Similarly,
the ceiling function is characterized by ⌈x⌉ = min{b ∈ Z ∣ b ≥ x}.)
The formula in (0.5) can be proved by recourse to (0.4), which is even more
surprising because it apparently had been found 50 years before Fibonacci!
0.3. History of the Tower of Hanoi 15
During its long history, the AT reappeared in many disguises. For instance,
evaluating the kth power of the binomial term a + b, we have to sum up products
of k factors containing either an a or a b from each of the k individual factors of
the power. Identifying a with short and b with long syllables from prosody, we see
that the product ak−` b` shows up precisely (k`) times, i.e. we arrive at
k
k
∀ k ∈ N0 ∶ (a + b)k = ∑ ( )ak−` b` .
`=0 `
This is the famous binomial theorem, and the (k`) are now commonly known
as binomial coefficients. However, this denomination addresses only one particular
aspect of these numbers and it is a breach of the historical facts; we therefore
prefer to call them combinatorial numbers.
In more modern terms, the combination of short and long syllables in a word
of length k can also be interpreted as choosing a subset from a set K with ∣K∣ = k
elements. Here 0 means that an element of K does not belong to the subset chosen,
while 1 means that it is an element of the subset. In other words, there are exactly
(k`) subsets of K which have precisely ` elements. Writing (K` ) for the set of all
subsets of K of order `, we get
K ∣K∣
∀ ` ∈ {0, . . . , ∣K∣} ∶ ∣( )∣ = ( ) .
` `
A sound mathematical description of the AT, based on this formula, and some
important notation can be found in Exercise 0.2.
The direct application of arguments based on choices is the starting point
for proving many interrelations between combinatorial numbers. For instance, if
you want to select ` balls from a collection of b black and w white balls, you may
successively pick λ black ones and then ` − λ white balls. There are (λb )(`−λ
w
) such
combinations, whence
b+w `
b w
∀ b, w, ` ∈ N0 ∶ ( ) = ∑ ( )( ). (0.6)
` λ=0 λ `−λ
This can be viewed as an extension of the recursive formula in Exercise 0.2 c),
which is case b = 1 of (0.6) and could therefore be called the black sheep formula.
Combinatorics is also the historical starting point for probability theory, which
has its early roots in discussions about games of chance. One of these was treated
mathematically by Euler in 1751 (see [97]) under the name of “Game of encounter”
(Jeu de rencontre). It had been studied earlier by Pierre Rémond de Montmort
in the first work entirely devoted to probability, his “Essay d’Analyse sur les Jeux
de Hazard”, whose second edition appeared in 1713, but Euler’s presentation is,
as usual, more clearly written.
Two players, A and B, hold identical packs of cards which are shuffled. They
start to compare card by card from their respective decks. If during this procedure
16 Chapter 0. The Beginning of the World
two cards coincide, then A wins. If all cards have been used up without such an
encounter having occurred, then B is the winner. The question is: what is the
probability of A (or B for that matter) to win. (In Montmort’s version, the number
of cards in each deck was 13, and the game was accordingly called “Jeu du Treize”.)
Euler solved this question in the following way. Let us assume that a deck
has k ∈ N0 cards and that the deck of A is naturally ordered from 1 to k; this
has to be compared with the k! possible decks B can hold. Some easy cases are
done first: for k = 0, B wins; for k = 1, A is the winner; for k = 2, the chances are
1 ∶ 1. The most instructive case is k = 3, where 2! = 2 decks of B, namely (1, 2, 3)
and (1, 3, 2), will make A the winner in the first round. In the second round, the
same number of decks ((1, 2, 3) and (3, 2, 1)), would be favorable for A, however,
one obviously has to delete deck (1, 2, 3), from this list. This is because it would
have made A the winner in the first round of a game with only 2 cards, namely
without card 2 present. This is a prototype application of the inclusion-exclusion
principle: an element must not be counted twice in the union of two (or more)
finite sets. Of the remaining 3 decks, A will win the third round with deck (2, 1, 3)
in B’s possession only, so all in all in 4 out of 3! = 6 cases. The general rule which
Euler found for the number fk,` of captures of A in round ` ∈ [k] is
From this, Euler deduces, by what we would call a double induction on k and `
today,
`−1
`−1
∀ k ∈ N ∀ ` ∈ [k] ∶ fk,` = ∑ (−1)m ( )(k − 1 − m)! . (0.7)
m=0 m
To obtain the number fk of decks of B favorable for A to win, we have to sum
equation (0.7) over `. Euler used an ingenious trick based on an observation about
the AT: if one adds the entries in a diagonal parallel to the left side of the triangle
down to a certain entry, one obtains the entry immediately to the right of it in
the next line, i.e.
k
`−1 k
∀ k ∈ N, m ∈ [k]0 ∶ ∑ ( )=( );
`=m+1 m m+1
this formula can also easily be proved by induction. We now get for k ∈ N:
k k `−1
`−1
fk = ∑ fk,` = ∑ ∑ (−1) (
m
)(k − 1 − m)!
`=1 `=1 m=0 m
k−1 k
`−1
= ∑ ∑ (−1)m ( )(k − 1 − m)!
m=0 `=m+1 m
k−1 k
`−1
= ∑ (−1)m (k − 1 − m)! ∑ ( )
m=0 `=m+1 m
k−1
k k−1
(−1)m
= ∑ (−1) (
m
)(k − 1 − m)! = k! ∑ .
m=0 m +1 m=0 (m + 1)!