Recreational mathematics
Recreational mathematics is mathematics done for fun. It covers puzzles, games, number curiosities, and surprising shapes.[1] Examples include magic squares (grids of numbers whose rows, columns, and diagonals all add to the same sum), river-crossing riddles, the Tower of Hanoi, and the Rubik's Cube.
Its problems run from simple amusements to hard questions, and some have never been solved.[1] A few puzzles even grew into whole fields of research. A puzzle about walking over the bridges of Königsberg started graph theory, and a question about splitting a gambler's stakes helped lay the foundation of probability theory.[2][3]
What it covers
Recreational mathematics is a broad family of problems, not one method. Its puzzles can draw on many fields:[1]
- arithmetic and algebra
- geometry
- number theory
- graph theory
- topology, the study of properties that stay the same when a shape is stretched or bent
- combinatorics, the study of arrangements
- logic
- probability
Britannica's survey notes that it is often hard to tell where a pastime ends and serious mathematics begins.[1]
Britannica sorts the material into four rough groups, while noting that no way of sorting it follows a fixed rule:[1]
- Number recreations: number patterns, puzzles about digits, and curious numbers such as the happy numbers or narcissistic numbers.
- Geometric and topological recreations: cutting shapes into pieces, mazes, map colouring, folded paper toys, and impossible figures.
- Hands-on puzzles and games: sliding puzzles, the Tower of Hanoi, polyominoes, and two-player games played with counters.
- Logic problems: logic puzzles, such as working out who tells the truth and who lies, and logical paradoxes.
Classic examples
A few famous puzzles show the flavour of the field.
Magic squares
A magic square is a grid of numbers in which every row, every column, and both main diagonals add up to the same total, called the magic constant. A standard magic square of side uses each whole number from 1 to once. The 3 by 3 square uses 1 to 9, and its lines each add to 15.[4]
River-crossing puzzles
In a river-crossing puzzle, travellers must get across a river under rules about who may be left together.[5]
The best-known version reads: a farmer must ferry a wolf, a goat, and a cabbage across a river in a boat that holds only the farmer and one item, and nothing may be left alone where it would be eaten.[5]
The earliest known puzzles of this type appear in a Latin collection from around the year 800 (see History).[5]
The Tower of Hanoi
The Tower of Hanoi has three pegs and a stack of disks of different sizes, starting on one peg with the largest at the bottom. The goal is to move the whole stack to another peg, one disk at a time, never putting a disk on a smaller one. A tower of 8 disks needs 255 moves.[6]
Kaprekar's routine
Kaprekar's routine is a process on four-digit numbers that D. R. Kaprekar of India created in 1949.[7] It works like this:
- Pick a four-digit number whose digits are not all the same.
- Arrange its digits from largest to smallest, and from smallest to largest, keeping any zeros so each number has four digits.
- Subtract the smaller number from the larger.
- Repeat with the result.
Every such starting number reaches 6174 within seven steps, and 6174 then repeats forever.[7] For example, 9871 − 1789 = 8082, then 8820 − 0288 = 8532, then 8532 − 2358 = 6174, and 7641 − 1467 = 6174 again.
The Game of Life
The Game of Life, invented by John Horton Conway, is played on an endless grid of square cells. Each cell has eight neighbours, four touching its sides and four touching its corners. Each cell is either filled (alive) or empty.[8]
All cells update at once, and each such update of all the cells is called a generation. The rules are:[8]
- Survival: a live cell with two or three live neighbours stays alive.
- Death: a live cell with four or more live neighbours dies of overcrowding, and one with one or no live neighbours dies of isolation.
- Birth: an empty cell with exactly three live neighbours comes to life.
These simple rules produce patterns that stay still, blink, or travel across the grid. The five-cell "glider" moves one cell diagonally every four generations.[8] A pattern that repeats itself over time, such as the blinker below, is called an oscillator.
Shape curiosities
Geometric recreations often show shapes that behave in unexpected ways. A flexagon is a polygon folded from a strip of paper that shows a different face when it is flexed.[2] One of the simplest is the trihexaflexagon, a flat hexagon with three faces, folded from a strip marked into 10 equal-sided triangles.[2][9]
Flexagons were first discussed in 1939.[2] The first one was folded that year by Arthur H. Stone, a graduate student at Princeton University.[9]
The Koch snowflake starts from a triangle and is built in steps:[10]
- Split each side into thirds.
- Replace the middle third with two sides of a smaller triangle pointing outward.
- Repeat forever on every new side.
Each stage makes the perimeter (the total length around the shape) 4/3 as long, so the perimeter grows without limit. The enclosed area still never exceeds 8/5 of the starting triangle's area.[10]
History
Puzzles for pleasure are very old, and many have been retold in new forms for centuries.[1] The timeline below marks some milestones from the sections that follow.
Medieval puzzle collections
The Propositiones ad Acuendos Juvenes ("Problems to Sharpen the Young") is the oldest collection of mathematical problems in Latin.[11] Its main facts:
- Date: it comes from the court of Charlemagne, around 800.[11]
- Author: manuscripts credit it to the scholar Alcuin of York (735 to 804), but there is no direct evidence that he wrote it or put it together.[5][12]
- Contents: it has 53 or 56 problems, depending on the copy.[5]
- Sources: many problem types were already known from older Chinese, Indian, Greek, and Roman sources, but river-crossing problems are not yet known from any earlier source.[5]
Interest in such problems grew through the Middle Ages, helped by printing and by writers of arithmetic textbooks. Contributors named by Britannica include Fibonacci (1202), Robert Recorde (1542), and Girolamo Cardano (1545).[1]
One problem from this era asks how many grains of wheat fill a chessboard if the first square holds 1 grain and each later square holds twice as many as the one before.[1]
Printed books of recreations
In the 17th century, whole books were given over to recreational problems.[1]
| Year | Author | Book | Note |
|---|---|---|---|
| 1612 | Claude-Gaspar Bachet de Méziriac | Problèmes plaisans et délectables | Mostly arithmetic puzzles; a model for later collections |
| 1624 | Jean Leurechon (as "van Etten") | Récréations mathématiques | At least 30 editions before 1700 |
| 1694 | Jacques Ozanam | Récréations mathématiques et physiques | A model for books over the next 200 years |
| 1882 to 1894 | Édouard Lucas | Récréations mathématiques, 4 volumes | Became a classic |
In the late 19th century, Lewis Carroll (C. L. Dodgson) wrote mathematical recreations including The Game of Logic, Pillow Problems, and A Tangled Tale.[1]
Puzzle columns and surveys
Around 1900, puzzle makers reached a mass audience through newspapers and magazines. Sam Loyd sold a weekly puzzle column to a national syndicate (a company that supplies material to many newspapers at once). Henry Dudeney wrote for the Strand Magazine and published popular puzzle collections.[1]
Academic surveys appeared in the same period.[1]
| Author | Work | Year | Details |
|---|---|---|---|
| W. W. Rouse Ball | Mathematical Recreations and Essays | 1892 | First edition; revised by H. S. M. Coxeter in 1938 and still a standard reference |
| Wilhelm Ahrens | Mathematische Unterhaltungen und Spiele | 1910 | Two volumes with a large list of sources |
Martin Gardner
Martin Gardner wrote the "Mathematical Games" column in Scientific American. Its main facts:
- Run: it began in December 1956 with an article on flexagons and ran until 1981.[13][14]
- Influence: it had a huge impact on the way people view mathematics, although Gardner had little mathematical training.[14]
- Books: the columns were later reprinted in fifteen books.[15]
- The Game of Life: the October 1970 column first presented Conway's Game of Life to the public.[8]
A shift toward harder topics
Around the middle of the 20th century, the field's interest shifted from number tricks and simple geometric puzzles toward harder topics. These included graphs, group theory (the mathematics of symmetry), topology, combinatorics, and paradoxes of the infinite (questions about infinity that seem to lead to contradictions).[1]
The field today
Recreational mathematics now has its own meetings and journals. The Gathering 4 Gardner is an invitation-only conference in Gardner's honour; the first was held in Atlanta in January 1993, and since 1996 they have usually been held every two years.[16] The Journal of Recreational Mathematics was published from 1968 to 2014.[17]
Why the puzzles work
This section gives the reasoning behind the magic sum and the Tower of Hanoi count from "Classic examples". It also adds new examples: parity (whether a count is odd or even) in the Fifteen Puzzle, the winning rule for Nim, and a computer search for the Rubik's Cube.
The magic sum
The magic constant of a standard magic square follows from adding all its numbers. The numbers 1 to add to , and this total splits equally among the rows, so[18]
Here is the number of cells on a side and is the sum of each row, column, and main diagonal. For this gives 15, and for it gives 34.[18]
There are exactly 880 standard 4 by 4 magic squares when rotations and reflections are not counted separately, or 7,040 in all.[19]
Counting Tower of Hanoi moves
The Tower of Hanoi count comes from a simple plan for moving disks:[20]
- Move the top disks to the spare peg.
- Move the largest disk to the goal peg.
- Move the disks back on top of it.
This plan is recursive, because it solves the puzzle by solving the same smaller puzzle twice.[20]
If is the number of moves this plan uses for disks, then and
Solving this gives , and no shorter solution exists.[6] A tower of 64 disks would need = 18,446,744,073,709,551,615 moves. That is the same number as the grains of wheat in the medieval chessboard problem.[6]
The puzzle is widely believed to have been invented by Lucas in 1883, though his role in its invention has been disputed.[6]
Parity and the Fifteen Puzzle
Parity can show that a puzzle has no solution, and the Fifteen Puzzle is a classic example.[6]
The puzzle is a tray of 15 numbered sliding squares and one blank space. The goal is to slide the squares into numerical order with the blank in the lower-right corner.[6]
Sam Loyd claimed to have invented the puzzle around 1878, but scholars have documented earlier inventors.[6]
The pieces, including the blank, can be arranged in more than 20,000,000,000,000 ways. In 1879, two American mathematicians proved that only half of these can be solved.[6] The test uses inversions:
- Read the numbers row by row, left to right, with the blank in the lower-right corner.
- Each time a number comes before a smaller number, count one inversion.
- If the total number of inversions is even, the puzzle can be solved. If it is odd, it cannot.[6]
For example, in the sequence 9, 5, 3, 4, the 9 comes before three smaller numbers and the 5 before two, giving five inversions.[6]
Winning at Nim
Nim is a two-player game with a complete winning strategy, which Charles Bouton published in 1901.[21] Players take turns removing one or more counters from a single pile, and whoever takes the last counter wins.[21]
Bouton's rule uses binary numbers:[21]
- Write each pile size in binary.
- Line up the digits in columns.
- Add each column.
If every column sum is even, the position is a "safe combination".[21]
| Pile | Size | Binary |
|---|---|---|
| 1 | 9 | 1001 |
| 2 | 5 | 0101 |
| 3 | 12 | 1100 |
| Column sums | 2, 2, 0, 2 |
All column sums here are even, so 9, 5, 12 is a safe combination.[21] Bouton proved that a player who leaves a safe combination can always leave another one on their next turn, while the opponent never can, so that player takes the last counter. The first player wins if the starting position is not safe, and loses against perfect play if it is.[21]
Searching by computer: the Rubik's Cube
Some puzzle questions are settled by huge computer searches. The Rubik's Cube has 43,252,003,274,489,856,000 positions.[22] The fewest moves that solve the hardest position is called God's number, and the method that always finds the shortest solution is called God's algorithm.[22]
Counting any twist of any face as one move, a position needing 20 moves was found in 1995. In July 2010, Tomas Rokicki, Herbert Kociemba, Morley Davidson, and John Dethridge proved that 20 moves are always enough. They used donated Google computer time equal to about 35 years on one processor.[22]
From play to research
Several puzzles have turned into serious branches of mathematics.
Königsberg and graph theory
The city of Königsberg (now Kaliningrad) lay on both banks of the Pregel River and on an island in it, joined by seven bridges. People asked whether someone could take a walk that crosses each bridge exactly once.[2] Leonhard Euler presented a paper on the problem to the St. Petersburg Academy in 1735 and wrote up his solution the following year.[23]
Euler's argument counts bridges. Five bridges lead to the island and three lead to each of the other three land areas.[24] A walk over all seven bridges passes through eight places in order. The island must appear three times in that list and each other area twice, which needs nine places, so no such walk exists.[24]
Euler's reasoning gives general rules for any connected network of points and lines. Call a point odd if an odd number of lines meet there.[2]
- The number of odd points is always even.
- With no odd points, a single route can trace every line once, starting and ending at the same point.
- With exactly two odd points, a single route can trace every line once, starting at one odd point and ending at the other.
- With more than two odd points, no single route can do it.
Euler proved that these conditions are needed, meaning a route can exist only when they hold. He discussed, but did not prove, that they are also enough for a route to exist. A valid proof that they are enough was not published until 1873, by Carl Hierholzer.[23]
Britannica dates the start of modern graph theory to this work, and such routes are now called Eulerian paths.[2] (See also Seven Bridges of Königsberg.)
Gambling and probability
The problem of points asks how to split the prize fairly when a game of chance stops before anyone has won. Luca Pacioli posed it in 1494.[3] In 1654 the gambler Antoine Gombaud brought it to Blaise Pascal, and Pascal's letters with Pierre de Fermat that year laid the foundation of modern probability theory.[3]
Both men looked at how the game could have continued, not at how it had gone so far.[3]
| Person | Approach |
|---|---|
| Fermat | Listed every possible outcome of the remaining rounds and counted those that each player would win |
| Pascal | Worked backward from the end of the game, one round at a time |
Combinatorial games
Conway produced results in combinatorial game theory, the study of two-player games with no chance and no hidden information. With Elwyn Berlekamp and Richard K. Guy, he wrote Winning Ways for Your Mathematical Plays (1982).[25]
Cellular automata
The Game of Life is an example of a cellular automaton, a grid of cells that update by fixed local rules. Conway built it while trying to simplify John von Neumann's idea of a machine that can build copies of itself.[25]
Polyominoes
The word polyomino was coined in 1953 as a joke on "domino".[6] A polyomino is a shape made of one or more equal squares joined along full edges into a single connected piece, so a lone square (a monomino) also counts.[26]
There are exactly 12 pentominoes (five squares) and 35 hexominoes (six squares), but no general formula is known for the number of polyominoes of each size.[6]
Map colouring and computer proofs
The four colour problem asked whether any flat map can be coloured with four colours so that neighbouring regions always differ. It was framed in 1852 and resisted proof until 1976, when mathematicians at the University of Illinois announced that four colours are enough.[2] Their proof used more than 1,000 hours of computer calculation and was the first major proof to rely heavily on a computer.[2]
A similar story belongs to squaring the square, the task of cutting a square into smaller squares that are all different sizes. It was thought impossible as early as 1907, and the first solution was reported in 1939.[10]
Related topics
The field includes many named numbers, puzzles, people, and publications. Pages on this site include:
- Number curiosities: automorphic numbers, factorions, Friedman numbers, Kaprekar numbers, Keith numbers, the look-and-say sequence, pandigital numbers, strobogrammatic numbers, vampire numbers, and the Ulam spiral.
- Puzzles and games: dissection puzzles, disentanglement puzzles, mathematical puzzles, mathematical games, mathematical card tricks, polyiamonds, polyhexes, polysticks, and the Pocket Cube.
- People: John Horton Conway, Henry Dudeney, Martin Gardner, Richard K. Guy, Sam Loyd, Lee Sallows, and Leo Moser.
- Books, magazines, and journals: The Penguin Dictionary of Curious and Interesting Numbers, To Mock a Mockingbird, Crux Mathematicorum, and Eureka.
- Ideas about numbers themselves: the interesting number paradox, the strong law of small numbers, and mathematical coincidences.
References
- Number game: Introduction and History, William L. Schaaf, Encyclopaedia Britannica, 2023.
- Number game: Graphs and networks, map colouring, flexagons, William L. Schaaf, Encyclopaedia Britannica, 2023.
- July 1654: Pascal's Letters to Fermat on the "Problem of Points", APS News, American Physical Society, 2009.
- Magic square, Encyclopaedia Britannica, accessed 2026.
- Problems to Sharpen the Young, John Carlos Baez, Azimuth, 2025.
- Number game: Manipulative recreations, William L. Schaaf, Encyclopaedia Britannica, 2023.
- Mysterious number 6174, Yutaka Nishiyama, Plus Magazine, University of Cambridge, 2006.
- Mathematical Games: The fantastic combinations of John Conway's new solitaire game "life", Martin Gardner, Scientific American, 1970.
- Mathematical Games: Flexagons, Martin Gardner, Scientific American, 1956.
- Number game: Geometric and topological recreations, William L. Schaaf, Encyclopaedia Britannica, 2023.
- The History of some of Alcuin's Propositiones, David Singmaster, in Charlemagne and his Heritage, vol. 2, Brepols, 1998.
- Review of Alcuin's Recreational Mathematics: River Crossings and other Timeless Puzzles, Tricia Muldoon Brown, Mathematical Association of America, 2026.
- Hexaflexagons, Martin Gardner, The College Mathematics Journal, 2012.
- Flexagon but Not Forgotten: Celebrating Martin Gardner's Birthday, Scientific American, 2012.
- Martin Gardner (1914 to 2010) biography, MacTutor History of Mathematics, University of St Andrews, accessed 2026.
- The Gathering, Gathering 4 Gardner, accessed 2026.
- Journal of recreational mathematics (catalogue record), Stanford Libraries SearchWorks, accessed 2026.
- Magic Constant, Eric W. Weisstein, Wolfram MathWorld, accessed 2026.
- Squaring the magic squares of order 4, Stefano Barbero, Umberto Cerruti, and Nadir Murru, arXiv, 2013.
- The Towers of Hanoi, Plus Magazine, University of Cambridge, 2006.
- Nim, A Game with a Complete Mathematical Theory, Charles L. Bouton, Annals of Mathematics, 1901.
- God's Number is 20, Tomas Rokicki, Herbert Kociemba, Morley Davidson, and John Dethridge, 2010.
- An historical note: Euler's Königsberg letters, Horst Sachs, Michael Stiebitz, and Robin J. Wilson, Journal of Graph Theory, 1988.
- Solution of a problem in the geometry of position (English translation), Leonhard Euler, translated by Michael Behrend, 1736.
- John Conway (1937 to 2020) biography, J. J. O'Connor and E. F. Robertson, MacTutor History of Mathematics, University of St Andrews, 2004.
- Polyomino, Eric W. Weisstein, Wolfram MathWorld, accessed 2026.
