A toy box of numbers

Binary, the prime sieve, the Josephus problem and the Collatz conjecture, three classic move-and-think puzzles, stone piles, the odd coin, four numbers for ten and Euclid’s algorithm. A small history of number play, and some surprising links.

Numbers make good toys: binary, primes, people leaving a circle, a number that finds its way back to 1. Add classic puzzles you move and think about, and games you win with numbers — many works, linked by short stories.

Binary Cards (the site’s “Binary Cards”)

Think of a number from 1 to 63, answer “Yes” or “No” to six cards, and the number is found. The top-left numbers on the cards are 32, 16, 8, 4, 2 and 1. Add up those on the cards you said “Yes” to and you get your number. Every number has exactly one combination of cards. That is binary, the way of writing numbers with only 0 and 1, one digit per card.

Leibniz sent a paper explaining binary arithmetic to the Royal Academy of Sciences in Paris. The volume is dated 1703 and was printed in 1705. The missionary Bouvet, in China, wrote that the diagram of the 64 hexagrams of the I Ching matches an ordering of binary numbers. Leibniz read it as the same thing as his own binary. But it cannot be said that the I Ching was binary. That is how Leibniz read it. Leibniz also was not the first to think of binary; there were predecessors. He is one who tidied binary up as mathematics and spread it.

Prime Sieve (the site’s “Prime Sieve”)

Cross out the multiples of 2, then of 3, then of 5, and so on from a table of numbers; what survives is the primes. There are 25 primes up to 100 and 78 up to 400. This site’s program checked both. Up to 100, it is enough to cross out multiples of 2, 3, 5 and 7, because the square root of 100 is 10. Up to 400, the eight primes up to 20 (2, 3, 5, 7, 11, 13, 17, 19) are enough. The program checked this too.

The name “Sieve of Eratosthenes” appears in a book by Nicomachus from the early 2nd century. He passes the method on as Eratosthenes’s, from the 3rd century BC. Whether Eratosthenes himself devised it cannot be said for sure.

Circle Elimination (the site’s “Circle Elimination”)

People stand in a circle and every so often one leaves. Who is left at the end? This is called the Josephus problem. When every other person leaves, write the number of people in binary and move the leading 1 to the end: you get the survivor. For 41 people, 101001 becomes 010011, which is person 19. The program checked this relation for group sizes up to 1000. When the group is a power of two (2, 4, 8, 16, …), person 1 always survives. This links back to the binary cards.

Josephus, who gives the problem its name, was a Jewish historian of the first century. In his own account, after hiding in a cave with companions, they drew lots to decide the order of their own deaths. That he and one other remained at the end, he wrote, might be “by chance, or by the providence of God.” There is no circle and no counting in that account. The problem was tidied into a circle with a counting step in a later age; a problem in Bachet’s book of 1612 is given as an example.

Hailstone Numbers (the site’s “Hailstone Numbers”)

Halve it if it is even; triple it and add one if it is odd. Repeat. Does every number come back to 1? This is the Collatz conjecture, said to have been asked by Lothar Collatz in 1937. Start at 27: it climbs to 9232, then returns to 1 in 111 steps. Among starts below 1000, the longest trip is 871, at 178 steps. This site’s program also checked that every start from 1 to 99999 returns to 1. The longest trip among them is 350 steps.

The conjecture is still unsolved. As of a paper published in 2025, computers have verified all starts below about 2.4 × 1021 (2 to the power 71). That record will surely be broken in time. But no number of checked cases amounts to a proof that it holds for every number.

Frog Leap (the site’s “Frog Leap”)

Green and brown frogs face each other in a line. They only go forward: onto the empty pad, or over one neighbour. The goal is to swap the two sides. It is a long-known puzzle. One frog each takes 3 moves, two each take 8, three each take 15. For n frogs a side the minimum is n × n + 2n moves. This site’s program checked n = 1 to 5. That is n × n hops and 2n steps. Because nothing can go back, there are positions from which the puzzle can never be finished.

Peg Solitaire (the site’s “Peg Solitaire”)

You jump over a peg to remove it, shrinking the pegs on the board. On the 33-hole cross board, starting with only the centre empty, 31 jumps can leave a single peg. There is also a way to leave that last peg in the centre. On the 15-hole triangle, whichever hole you empty first, 13 jumps can leave one peg. This site’s program checked all 15 starting holes.

The earliest solid trace is said to be an engraving of 1697 showing a lady of the court of Louis XIV holding a board. Leibniz is also said to have mentioned the game in 1710. The story that “a prisoner in the Bastille invented it” is said to rest on weak ground. It first appears in 1810, over a hundred years after the supposed time.

Torch Across the Bridge (the site’s “Torch Across the Bridge”)

Cross a bridge at night with one torch. The bridge holds two, and a pair goes at the slower person’s speed. For people taking 1, 2, 5 and 10 minutes, the best total is 17 minutes. The plan where the fastest person escorts everyone takes 19. Sending the two slowest together is the key to 17. Intuition is a little bit of a trap here. The search on this site agrees with a well-known formula over many sets of times.

For four people (A, B, C, D from fastest to slowest), the best total is said to be the smaller of 2A + B + C + D and A + 3B + D (as organised by Rote in 2002). In the example, the smaller is A + 3B + D: 1 + 6 + 10 = 17. The origin is unclear. All that can be said is that an example appears in a book of 1981.

Stone Piles (the site’s “Stone Piles”)

There are several piles of stones. Two players take turns removing any number of stones from one pile, and whoever takes the last stone wins. The key to winning is binary numbers. Write each pile’s size in binary and count the 1s in each column. If every column has an even number of 1s, the player about to move is losing (this is called “XOR equals zero”). If any column is odd, there is a move that makes every column even again, so the player to move can win. For example, piles of 3, 4 and 5 are 011, 100 and 101 in binary. The columns hold 2, 1 and 2 ones, and only the middle one is odd, so the player to move wins.

This site’s program checked the following.

  • Searching every move in all positions with up to four piles of 0 to 6 stones, the positions where every column is even are exactly the losing positions.
  • From a winning position, the winning move always lands on an all-even position.
  • Starting from a winning position, the computer cannot lose, whatever its opponent does.

We have no well-documented source to point to for who first thought of this game or when. The rules are simple, but binary numbers turn up in the middle of it, and that is the charm.

The Odd Coin (the site’s “The Odd Coin”)

One coin among many has a different weight. With a balance scale and only a fixed number of weighings, you must say which coin it is. The useful way to count is that one weighing has three possible outcomes: the left side is heavier, the right side is heavier, or they balance. Two weighings can give 3 × 3 = 9 outcomes, and three weighings 3 × 3 × 3 = 27.

  • 9 coins, one of them heavy: there are 9 cases for which coin it is. Two weighings give exactly 9 outcomes, which is just enough. One weighing cannot do it.
  • 12 coins, one different (heavy or light unknown): 12 choices of coin times 2 (heavy or light) is 24 cases. Three weighings give 27 outcomes, at least 24, so it might be possible. Two weighings give only 9, which is too few.

This site’s program checked these. For 12 coins it finds a three-weighing plan that settles all 24 cases, and its search finds no plan at all with two or one weighings. But “27 is at least 24” alone does not guarantee success. If the first weighing puts 6 coins against 6, it cannot balance, and the remaining 12 cases cannot be separated by the 9 outcomes of two more weighings, so that start fails. The plan the program found begins with 4 coins against 4.

We have no well-documented source to point to for the origin of this puzzle or when it first became known.

Four Numbers Make Ten (the site’s “Four Numbers Make Ten”)

Combine four digits from 1 to 9, two at a time, with plus, minus, times and divide, to make exactly 10. There are 495 ways to choose the four digits (repeats allowed, order ignored). This site’s program found that 447 of them can make 10. A separately written checker agreed on all 495.

  • 1, 1, 1, 1 and 1, 1, 7, 7 cannot make 10.
  • The sets that need a fraction along the way, in every solution, are exactly four: 1, 1, 5, 8; 1, 1, 9, 9; 1, 3, 3, 7; and 3, 4, 7, 8.
  • Some sets, such as 3, 3, 3, 3 and 1, 1, 1, 4, have essentially only one way of writing the answer.

In the fraction sets, a step may leave the whole numbers, yet the end result is exactly 10. The assumption that every step must stay a whole number can get in the way of the idea. Similar games have existed for a long time, but we have no well-documented source for the origin of this particular one.

Cutting Squares (the site’s “Cutting Squares”)

Take two numbers as the sides of a rectangle and repeatedly cut off the biggest square. The side of the last square left over is the greatest common divisor of the two numbers. This is a picture of the method called Euclid’s algorithm. Written as divisions:

  • 48 = 2 × 18 + 12 (cut two squares of side 18)
  • 18 = 1 × 12 + 6 (cut one square of side 12)
  • 12 = 2 × 6 + 0 (two squares of side 6 fit exactly)

So the greatest common divisor of 48 and 18 is 6. There are 2 + 1 + 1 = 4 cuts, and the last square of side 6 is left uncut. This site’s program checked the following.

  • For every pair of numbers from 1 to 40, the side of the leftover square equals the greatest common divisor found by brute force.
  • The cut squares plus the leftover square add up exactly to the area of the original rectangle.
  • Each division line has the form “big = quotient × small + remainder”, and the small number and remainder of one line become the big and small numbers of the next.

Beyond the fact that the method carries the name of Euclid of ancient Greece, we cannot give further historical detail here with sources.

Grains on a Chessboard (the site’s “Grains on a Chessboard”)

Put 1 grain on the first square of a chessboard, 2 on the second, 4 on the third, and keep doubling on every square. How many are on the 64th? Mere doubling makes the number balloon at once. Square n holds 2 to the power (n−1) grains, so the 64th square holds 9,223,372,036,854,775,808. The whole board holds 2 to the power 64, minus 1: 18,446,744,073,709,551,615 grains. There is also a rule that the total up to any square is one grain short of the next square’s count. The program checked all of these.

The story is told as a legend: an inventor asks for a reward of wheat, doubling on each square of the board. The oldest record is said to be by Ibn Khallikan in 1256 (this comes from a secondary source). The inventor’s name and the ending differ from teller to teller. Here it is presented as a story. The conversion of grains into weight is marked in the work as an assumed value, not a firm figure.

All of them are about noticing a pattern

  • Binary and Josephus: write the number in binary and a rule appears.
  • Sieve: notice that the square root is enough, and the work shrinks.
  • Collatz: easy to test, still without a proof.
  • Frog Leap and Peg Solitaire: some moves cannot be undone, so look ahead.
  • Bridge crossing: doubt the instinct to keep reusing the fastest person.
  • Stone Piles and Euclid’s algorithm: a pattern hides in binary numbers and in the division lines.
  • The Odd Coin and Four Numbers Make Ten: counting the possible outcomes tells you in advance whether it can be done.

In each of these works, hints begin with the idea. Try just that first.

Sources

Updated: 2026-10-17