0% found this document useful (0 votes)
83 views30 pages

The Tower of Hanoi Myths and Maths

The document is a comprehensive exploration of the Tower of Hanoi puzzle, detailing its history, mathematical significance, and various related puzzles. It addresses common myths and misconceptions, aiming to clarify and unify the existing literature on the topic. The authors also discuss the mathematical theories and applications related to the puzzle, including the Frame-Stewart conjecture and its implications in recreational mathematics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
83 views30 pages

The Tower of Hanoi Myths and Maths

The document is a comprehensive exploration of the Tower of Hanoi puzzle, detailing its history, mathematical significance, and various related puzzles. It addresses common myths and misconceptions, aiming to clarify and unify the existing literature on the topic. The authors also discuss the mathematical theories and applications related to the puzzle, including the Frame-Stewart conjecture and its implications in recreational mathematics.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

The Tower of Hanoi – Myths and Maths

Andreas M. Hinz Sandi Klavžar


Uroš Milutinović Ciril Petr


The Tower of Hanoi –


Myths and Maths
Foreword by Ian Stewart
Andreas M. Hinz Uroš Milutinović
Faculty of Mathematics, Faculty of Natural Sciences
Computer Science and Statistics and Mathematics
LMU München University of Maribor
Munich Maribor
Germany Slovenia

Sandi Klavžar Ciril Petr


Faculty of Mathematics and Physics Faculty of Natural Sciences
University of Ljubljana and Mathematics
Ljubljana University of Maribor
Slovenia Maribor
Slovenia
and

Faculty of Natural Sciences


and Mathematics
University of Maribor
Maribor
Slovenia

ISBN 978-3-0348-0236-9 ISBN 978-3-0348-0237-6 (eBook)


DOI 10.1007/978-3-0348-0237-6
Springer Basel Heidelberg New York Dordrecht London

Library of Congress Control Number: 2012952018

Mathematics Subject Classification: 00-02, 01A99, 05-03, 05A99, 05Cxx, 05E18, 11Bxx, 11K55,
11Y55, 20B25, 28A80, 54E35, 68Q25, 68R05, 68T20, 91A46, 91E10, 94B25, 97A20

Ó Springer Basel 2013


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of
the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations,
recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or
information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar
methodology now known or hereafter developed. Exempted from this legal reservation are brief
excerpts in connection with reviews or scholarly analysis or material supplied specifically for the
purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the
work. Duplication of this publication or parts thereof is permitted only under the provisions of
the Copyright Law of the Publisher’s location, in its current version, and permission for use must always
be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright
Clearance Center. Violations are liable to prosecution under the respective Copyright Law.
The use of general descriptive names, registered names, trademarks, service marks, etc. in this
publication does not imply, even in the absence of a specific statement, that such names are exempt
from the relevant protective laws and regulations and therefore free for general use.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for
any errors or omissions that may be made. The publisher makes no warranty, express or implied, with
respect to the material contained herein.

Printed on acid-free paper

Springer Basel is part of Springer Science+Business Media (www.birkhauser-science.com)


Foreword

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.

Andreas M. Hinz München, Germany


Sandi Klavžar Trzin, Slovenia
Uroš Milutinović Maribor, Slovenia
Ciril Petr Hoče, Slovenia
Contents

Foreword by Ian Stewart v

Preface vii

0 The Beginning of the World 1


0.1 The Legend of the Tower of Brahma . . . . . . . . . . . . . . . . . . . 1
0.2 History of the Chinese Rings . . . . . . . . . . . . . . . . . . . . . . . . 3
0.3 History of the Tower of Hanoi . . . . . . . . . . . . . . . . . . . . . . . 6
0.4 Puzzles and Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
0.5 Quotient Sets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
0.5.1 Equivalence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
0.5.2 Group Actions and Burnside’s Lemma . . . . . . . . . . . . . . 39
0.6 Early Mathematical Sources . . . . . . . . . . . . . . . . . . . . . . . . 41
0.6.1 Chinese Rings . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
0.6.2 Tower of Hanoi . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
0.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50

1 The Chinese Rings 53


1.1 Theory of the Chinese Rings . . . . . . . . . . . . . . . . . . . . . . . . 53
1.2 The Gros Sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
1.3 Two Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
1.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68

2 The Classical Tower of Hanoi 71


2.1 Perfect to Perfect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
2.2 Regular to Perfect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
2.3 Hanoi Graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
2.4 Regular to Regular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
2.4.1 The Average Distance on H3n . . . . . . . . . . . . . . . . . . . 113
2.4.2 Pascal’s Triangle and Stern’s Diatomic Sequence . . . . . . . 121
2.4.3 Romik’s Solution to the P2 Decision Problem . . . . . . . . . 124
2.4.4 The Double P2 Problem . . . . . . . . . . . . . . . . . . . . . . 127
xiv Contents

2.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128

3 Lucas’s Second Problem 131


3.1 Irregular to Regular . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
3.2 Irregular to Perfect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
3.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140

4 Sierpiński Graphs 141


4.1 Sierpiński Graphs With Base 3 . . . . . . . . . . . . . . . . . . . . . . 141
4.2 General Sierpiński Graphs . . . . . . . . . . . . . . . . . . . . . . . . . 149
4.2.1 Distance Properties . . . . . . . . . . . . . . . . . . . . . . . . . 150
4.2.2 Other Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
4.2.3 Sierpiński Graphs as Interconnection Networks . . . . . . . . 158
4.3 Connections to Topology: Sierpiński Curve and Lipscomb Space . . 160
4.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163

5 The Tower of Hanoi with More Pegs 165


5.1 The Reve’s Puzzle and the Frame-Stewart Conjecture . . . . . . . . . 165
5.2 Frame-Stewart Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . 170
5.3 Numerical Evidence for The Reve’s Puzzle . . . . . . . . . . . . . . . 179
5.4 Even More Pegs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
5.5 Hanoi Graphs Hpn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
5.6 Numerical Results and Largest Disc Moves . . . . . . . . . . . . . . . 200
5.6.1 Path Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
5.6.2 Largest Disc Moves . . . . . . . . . . . . . . . . . . . . . . . . . 202
5.7 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209

6 Variations of the Puzzle 211


6.1 What is a Tower of Hanoi Variant? . . . . . . . . . . . . . . . . . . . . 211
6.2 The Tower of Antwerpen . . . . . . . . . . . . . . . . . . . . . . . . . . 218
6.3 The Bottleneck Tower of Hanoi . . . . . . . . . . . . . . . . . . . . . . 222
6.4 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226

7 The Tower of London 227


7.1 Shallice’s Tower of London . . . . . . . . . . . . . . . . . . . . . . . . . 227
7.2 More London Towers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
7.3 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238

8 Tower of Hanoi Variants with Oriented Disc Moves 241


8.1 Solvability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 241
8.2 An Algorithm for Three Pegs . . . . . . . . . . . . . . . . . . . . . . . 245
8.3 More Than Three Pegs . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
8.4 Exponential and Sub-Exponential Variants . . . . . . . . . . . . . . . 256
8.5 Exercises . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
Contents xv

9 The End of the World 261

A Hints and Solutions to Exercises 265

Glossary 293

Bibliography 297

Name Index 319

Subject Index 323

Symbol Index 333


Chapter 0

The Beginning of the World

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.

0.1 The Legend of the Tower of Brahma


“D’après une vieille légende indienne, les brahmes se succèdent depuis bien
longtemps, sur les marches de l’autel, dans le Temple de Bénarès, pour exécuter
le déplacement de la Tour Sacrée de Brahma, aux soixante-quatre étages en or
fin, garnis de diamants de Golconde. Quand tout sera fini, la Tour et les brahmes
tomberont, et ce sera la fin du monde!”
These are the original words of Professor N. Claus (de Siam) of the Collège
Li-Sou-Stian, who reported, in 1883, from Tonkin about the legendary origins of a
“true annamite head-breaker”, a game which he called LA TOUR D’HANOÏ (see
[58]). We do not dare to translate this enchanting story written in a charming
language and which developed through the pen of Henri de Parville into an even
more fantastic fable [256]. W. W. R. Ball called the latter “a sufficiently pretty
conceit to deserve repetition” ([23, p. 79]), so we will follow his view and cite Ball’s
most popular English translation of de Parville’s story:
“In the great temple at Benares, beneath the dome which marks the centre of the
world, rests a brass-plate in which are fixed three 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 sixty-four 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
Bramah [sic!]. Day and night unceasingly the priests transfer the discs from one
diamond needle to another according to the fixed and immutable laws of Bramah
[sic!], which require that the priest 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 sixty-four discs shall have been thus transferred from the needle on

A. M. Hinz et al., The Tower of Hanoi – Myths and Maths,


DOI: 10.1007/978-3-0348-0237-6_1, Ó Springer Basel 2013
2 Chapter 0. The Beginning of the World

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,

Figure 0.1: Édouard Lucas, 1842–1891

a series of four volumes of “Récréations mathématiques” [214, 218, 215, 216]3 ,


accomplished posthumously in 1894. They stand in the tradition of J. Ozanam’s
popular “Récréations mathématiques et physiques” which saw editions from 1694
until well into the 18th century. The fourth volume of this work contains a plate
[249, pl. 16 opposite p. 439] showing in its Figure 47 what the author calls “Sigillum
Salomonis”. It is a mechanical puzzle which Lucas discusses in the first volume of
his series under the name of “baguenaudier” (cf. [209, p. 161–186]) and to which his
leaflet [58] refers for more details on the TH which only much later enters volume
three [215, p. 55–59]. It seems that this more ancient puzzle was the catalyst for
Lucas’s TH.

0.2 History of the Chinese Rings


The origin of the solitaire game Chinese rings (CR), called jiulianhuan (“Nine
linked rings”, 九连环) in today’s China, seems to be lost in the haze of history.

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.

Figure 0.2: The Chinese rings


(courtesy of James Dalgety, http://puzzlemuseum.org)
© 2012 Hordern-Dalgety Collection

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

The puzzle consists of a system of nine rings, bound together in a sophisti-


cated mechanical arrangement, and a bar (or shuttle as in weaving) with a handle
at one end. At the beginning, all rings are on the bar. They can be moved off
or back onto the bar only at the other end, and the structure allows for just two
kinds of individual ring moves, the details of which we will discuss in Chapter 1.
The task is to move all rings off the bar. Let us assume for the moment that this
and, in fact, all states, i.e. distributions of rings on or off the bar, can be reached.
(Lucas [214, p. 177] actually formulates the generalized problem to find a shortest
possible sequence of moves to get from an arbitrary initial to an arbitrary goal
state.) Then we may view the puzzle as a representation of binary numbers from
0 to 511 = 29 − 1 if we interpret the rings as binary digits, or bits, 0 standing for
a ring off the bar and 1 for a ring on the bar. This leads us back even further in
Chinese history, or rather mythology, namely to the legendary Fu Xi (伏羲), who
lived, if at all, some 5000 years ago. To him Leibniz attributes [189, p. 88f] the ba
gua (八卦), the eight trigrams consisting of three bits each, and usually depicted
in a circular arrangement as in Figure 0.3, where a broken (yin, 阴) line stands for
0, a solid (yang, 阳) line for 1, and the least significant bit is the outermost one.

Figure 0.3: Fu Xi’s arrangement of the trigrams

Legend has it that Fu Xi saw this arrangement on the back of a tortoise.


(Compare also to the Korean flag, the Taegeukgi.) Following the yin-yang symbol
in the center of the figure, Fu Xi, Leibniz and we recognize the numbers from
0 to 7 in binary representation. Doubling the number of bits will give a supply
of 64 hexagrams for the I Ching (yi jing, 易经), the famous Book of Changes;
cf. [352] and [209, p. 149–151]. It seems, however, that Leibniz went astray with
the philosophical and religious implications he drew from yin and yang; see [321].
On the other hand, the mathematical implications of binary thinking can not be
over-estimated.
6 Chapter 0. The Beginning of the World

0.3 History of the Tower of Hanoi


The sixth chapter in [209] was devoted by Lucas to “The Binary Numeration”. Here
he describes the advantages of the binary system [209, p. 148f], the Yi Jing [209,
p. 149–151], and perfect numbers [209, p. 158–160], before he starts his seventh
recreation on the baguenaudier, as mentioned before. We do not find, however,
the most famous of Lucas’s recreations in this first edition, the TH. This is not
surprising though. In the box containing the original game, preserved today in the
Musée des arts et métiers in Paris, one can find the following inscription, most
probably in Lucas’s own hand:

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

Figure 0.4: The original Tower of Hanoi


© Musée des arts et métiers–Cnam Paris / photo M. Favareille
8 Chapter 0. The Beginning of the World

Figure 0.5: Base plate of the original puzzle


© Musée des arts et métiers–Cnam Paris / photo M. Favareille
0.3. History of the Tower of Hanoi 9

Figure 0.6: The cover plate of the Tower of Hanoi

(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

18 446 744 073 709 551 615 , (0.1)

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

22 = 4, and so forth. Then every natural number N ≥ 1 can (uniquely) be written


as (NK−1 . . . N1 N0 )2 , such that N = ∑k=0 K−1
Nk ⋅ 2k with K ∈ N and Nk ∈ {0, 1},
NK−1 = 1. (This needs a mathematical proof, but we will not go into it. The
index “2” is meant to distinguish this representation of N from the decimal one;
the brackets may be omitted.) Clearly, 2n = 10 . . . 02 with n bits 0 and by binary
arithmetic, 1 . . . 12 = 2n − 1 with n bits 1. Now doubling a number and adding 1
means concatenating a bit 1 to the right of the number. The recursive solution
therefore needs 2n − 1 moves to transfer a tower of n discs. Calculating the 64-fold
product of 2 and subtracting 1 in decimal representation, we arrive at the number
shown in (0.1).
This number evokes another “Indian” myth which comes in even more versions
than the Tower of Brahma. The nicest, but not the first, of these legends is by
J. F. Montucla [242, p. 379–381], who tells us, in citing the gorgeous number, that
the Indian Sessa, son of Daher (Sissa ben Dahir), invented (a prototype of) the
chess game which he presented to the Indian king (Shirham). The latter was so
pleased that he offered to Sessa whatever he desires. Contrary to our experience
with fairy tales, Sessa did not ask for the daughter of the king, but pronounced a
“modest” wish: a grain of wheat (rice in other versions) on the first square of the
chess board, two on the second, four on the third and so on up to the last, the
64th one. The king’s minister, however, found out that it was impossible to amass
such an amount of wheat and we are told by Montucla that the king admired
Sessa even more for that subtle request than for the invention of the game. (In
less romantic versions, Sessa was beheaded for his impertinence.)
In this “arithmetic bagatelle”, as Montucla called it, we recognize immedi-
ately, that Sessa asked to concatenate a bit 1 to the left of the binary number of
grains when adding a new square of the board, all in all 1 . . . 12 = 264 − 1 grains.
With the Mersenne numbers5 (for M. Mersenne) Mk = 2k − 1, we have an
example of a sequence (Mk )k∈N0 , called Mersenne sequence, which fulfills two
recurrences
M0 = 0, ∀ k ∈ N0 ∶ Mk+1 = 2Mk + 1 , (0.2)
M0 = 0, ∀ k ∈ N0 ∶ Mk+1 = Mk + 2k . (0.3)
We will see later that (0.2) and (0.3) are prototypes of a most fundamental type
of recurrences, each of them leading to a uniquely determined sequence.
The most ubiquitous of all sequences defined by a recurrence is even older. In
his manuscript Liber abbaci of 1202/1228, Leonardo Pisano, now commonly called
Fibonacci (figlio di Bonaccio), posed the following problem:
Quot paria coniculorum in uno anno ex uno pario germinentur.
The solution of the famous rabbit problem invoked the probably most popular
integer sequence of all times, which was accordingly named Fibonacci sequence by

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

F0 = 0, F1 = 1, ∀ k ∈ N0 ∶ Fk+2 = Fk+1 + Fk . (0.4)

Lucas employed this sequence in a somewhat more serious context in connection


with the distribution law for prime numbers in [207], thereby introducing a variant,
namely the sequence (for k ≥ 1) Lk ∶= F2k /Fk which fulfils the same recurrence
relation as in (0.4), but with the seeds replaced by L1 = 1 and L2 = 3 (or by
L0 = 2, L1 = 1 to start the sequence at k = 0). Lucas still named this sequence for
Fibonacci as well in [206, p. 935], but it is now called the Lucas sequence (and its
members Lucas numbers). Fibonacci and Lucas numbers can also be calculated
explicitly and they exhibit an interesting relation to the famous Golden section as
shown in Exercise 0.1; cf. [329]. The methods developed in [207] allowed Lucas to
decide whether certain numbers are prime or not without reference to a table of
primes, and he announced his discovery that 2127 − 1 is a (Mersenne) prime. (Is
there a relation to the TH with 127 discs?) With this he was the last human world
record holder for the “largest” prime number, to be beaten only by computers 75
years later, albeit using Lucas’s method.
Édouard Lucas has never been properly recognized in his home country
France, neither in his time, nor today. In 1992, M. Schützenberger writes (to
be found in [289]): “...Édouard Lucas, who has no reputation among professional
mathematicians, however, because he is schools inspector and does not publish
anything else but books on entertaining mathematics.” Only in 1998 [69] and with
her thesis [70], A.-M. Décaillot put the life and number-theoretical work of Lu-
cas into light. Before that there were just two short biographies in [142, p. 540f]
and [339, Section 3.1]. Already in 1907 appeared a collection of biographies and
necrologies [219]. As it turns out, Lucas was in the wrong place at the wrong time:
with his topics from number theory and his enthusiasm for teaching and popular-
izing mathematics he put himself outside the infamous main-stream. Being in the
wrong place at the wrong time seemed to be Lucas’s fate: the story of his death
sounds as if it was just a malice of N. Claus (de Siam). Although the source is
unknown, we give here a translation of the most moving of all accounts from the
journal La Lanterne of 6 October 1891 [219, p. 17]:

The death of this “prince of mathematics”, as the young generations


of students called him, has been caused by a most vulgar accident. In
a banquet at which assisted the members of the [Marseille] congress
during an excursion into Provence, a [male] servant, who found himself
behind the seat of M. Edouard Lucas, dropped, by unskilfulness, a pile
of plates. A broken piece of porcelain came to hit the cheek of M. Lucas
and caused him a deep injury from which blood flew in abundance.
Forced to suspend his work, he returned to Paris. He took to his bed
and soon appeared erysipelas which would take him away.
0.3. History of the Tower of Hanoi 13

É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.”

Indian Verses, Polish Curves, and Italian Pavements


B. Pascal is known, among other things, for the triangle which in his seminal
treatise, published posthumously in 1665, he called the Arithmetical triangle (AT)
(cf. [81]). However, the famous arrangement of numbers was known long before
him and can be found implicitly as early as in the tenth century in a commentary
on Piṅgala’s “Chandah.śāstra” (ca. -200) by Halāyudha (cf. [161, p. 112f] and [139,
Section 3.4]). The Mount Meru (Meru-Prastāra) according to this description can
be seen in Figure 0.8.
The rule is to start with a 1 in the single square on top and to fill out each
subsequent line by writing the sum of the touching squares of the line immediately
above. Piṅgala was investigating poetic meters of short (0) and long (1) syllables,
a discipline called prosody. The problem was to analyze their combinations, and
this can be viewed as the birth of combinatorics. In how many ways can they be
14 Chapter 0. The Beginning of the World

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

∀ k ∈ N ∶ fk,1 = (k − 1)! ∧ ∀ ` ∈ [k − 1] ∶ fk,`+1 = fk,` − fk−1,` .

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)!

You might also like