Computation — page 5
The rectangles a square can be cut into
Cut a square into rectangles that all have the same shape — the same ratio of long side to short, in any sizes, lying either way. Two to one is easy. The golden ratio is impossible, however many pieces are used and however small. The ratio φ squared works with six. What decides it is not the ratio but its partner: the number obtained by changing the sign of the square root, which must be positive. Changing that sign is a map that keeps every sum and product and scrambles every size, and areas that must add up to one cannot all turn negative.
A code built from an icosahedron
Write down which corners of an icosahedron are not joined by an edge, put the table beside a diagonal of ones, and add the twelve rows together in every combination. The 4,096 strings of 24 bits that come out differ from each other in at least eight places, occur in only five weights, and — with one bit deleted — fill the space of 23-bit strings so exactly that every one of the 8,388,608 lies within three flips of exactly one of them. This is the Golay code, which carried Voyager's pictures home, and its words of weight eight cover every five of the twenty-four positions exactly once.
A code that survives a lost bit
A flipped bit leaves the word the right length and wrong in one place; a lost bit leaves it one short, with no sign of where the gap was. Keep only the words whose 1s sit at positions adding up to a multiple of n + 1, and any single lost bit can be put back. The price is about log₂(n + 1) bits, the same as the Hamming code pays for a flip.
A sum that never leaves its circle
Add up e^(2πi(x + x̄)/p) over the nonzero x modulo a prime, where x̄ is the inverse of x. A thousand unit steps could go a thousand units; Kloosterman's sum never goes beyond 2√p, and at a fixed prime its values over every choice of coefficient fall on a semicircle whose moments are the Catalan numbers. Follow one sum through the primes instead and the same semicircle appears — and nobody can prove it.
Dudeney's four pieces are the fewest
In 1902 Henry Dudeney cut an equilateral triangle into four pieces that rearrange into a square, and hinged them so the triangle folds into the square in one motion. For a hundred and twenty-two years nobody could say whether three pieces would do. In December 2024 Erik Demaine, Tonan Kamata and Ryuhei Uehara proved they would not. The construction, built exactly here, shows why four is natural; the proof shows why it is necessary.
Two lost bits
One congruence repairs any single lost bit, and the set of words it defines is believed to be the best possible. Two lost bits defeat it. An exhaustive search finds the largest codes that survive two — 2, 2, 4, 5, 7 and 11 words for lengths 4 to 9 — and Helberg's congruence, with weights that grow like Fibonacci numbers, gives a code that provably works at every length but spends a fixed share of every bit on protection. The best codes need only about four times the logarithm of the length.
How few distances fix a word
An unknown word of a thousand bits can be read one bit at a time with a thousand questions. Ask instead for its distance from a chosen word, and each answer is worth about half of log₂ n bits, so roughly two hundred distances fix it. A balance reading many coins at once is the same question. So is Mastermind, in which Knuth's rule finds any of the 1,296 codes in at most five guesses and a mean of 4.476, and no first guess is best on both counts.
A sort that never looks at the answers
Most sorting decides its next comparison from the last one. A sorting network decides them all in advance: a fixed sequence of swaps-if-out-of-order, wired up before any number arrives. Whether such a thing sorts everything can be settled by trying 2ⁿ strings of noughts and ones instead of n! orderings. Nineteen comparators sort eight numbers, and proving that nothing shorter sorts eleven took decades and a satisfiability solver. Over neighbours only, one single test, the reversed row, decides the whole question.
Two shares know nothing
Hide a number as the constant term of a quadratic modulo a prime and give eight people one value each. Any three can recover it. Any two know exactly nothing: of the 2,197 quadratics modulo 13, those matching two shares split into exactly one for each possible secret. Over the whole numbers the same two shares already give away the secret's parity.
Parallel planes take a vote
Draw a four-dimensional space with two values to a coordinate as a 4 × 4 grid, and mark its hyperplanes: thirty-two patterns any two of which differ on eight of sixteen squares. A polynomial's top coefficient can be read off any plane, and parallel planes do not overlap, so an error spoils only one vote. One of them flew to Mars, and in 2016 it turned out to reach Shannon's limit.
Thirteen convex tangrams
The seven tangram pieces make thousands of figures, and only thirteen of them are convex. The proof turns a puzzle with sliding pieces into a finite list: every piece is made of the same small triangle, any convex figure puts them all on one grid, and that grid allows exactly twenty convex outlines of the right area. A search tries all twenty and finds that thirteen can be made.
Wrong guesses that arrive together
Seven players in red or blue hats each see every hat but their own, and must guess their own colour or pass. Every guess is a coin toss, yet with the Hamming code the team wins seven times in eight — not by making guesses better, but by making the wrong ones arrive together. The best chance for any number of players is fixed by the fewest losses that cover the cube.
The slides a compass could have made
Slide a marked ruler through a point until one mark sits on each of two perpendicular lines, and the positions solve a quartic. Usually no compass can find them. Put the point on the bisector and every position is two square roots away, which is why the ancient vergings of a square were plane problems. Off the bisector the dividing line is a cubic with a whole-number root: 18 of 1,694 small slides pass, the point (1, 7) passes at infinitely many lengths, and (1, 2) at none yet found.
A deck where any two cards match once
A card game deals cards of eight pictures each, and any two cards in the deck share exactly one picture. The deck is the projective plane of order seven with its lines dealt as cards — 57 of them, of which the game prints 55. The two left out can be reconstructed from the counts of the pictures alone; a deck built one card at a time, by careful search, gets stuck at about two dozen; and the bound of 57 needs one exception, a deck that never stops.
Queens on a torus, and the squares whose every diagonal is a transversal
Roll a chessboard into a torus so that its diagonals wrap round, and ask for n queens that do not attack. Pólya proved in 1918 that it can be done exactly when n shares no factor with 6, by two short sums. A Latin square whose every wrapped diagonal holds each symbol once — a Knut Vik design, from Norwegian field trials — is the same problem solved n times at once. Search finds 10, 28, 88 and 4,524 placements at 5, 7, 11 and 13; every one is a straight line until 13, where 4,394 are not.
Twenty questions when one answer may lie
Twenty yes-or-no questions find any number up to a million. Allow the person answering to lie once, and twenty are no longer enough — and the exact number needed is decided by a single conserved quantity, Berlekamp's weight, which every question splits between its two answers. The weight says 25; an exhaustive search of the game confirms that the bound is met for almost every range, missing it by one question only at 3, 5, 9, 51 and 93 below 300; and the questions can even be written down in advance, as a code.
Every pair once, at every table
Eight players are to meet in pairs, four pairs a round at four of seven tables, so that every two players are partners exactly once and every player visits every table exactly once. The schedule is a square of seven rows and seven columns with a pair in some cells and nothing in the others, and it exists. With six players it does not, and with four it does not — and from eight players on it always does. The square is two ways of splitting the same pairs into rounds that cut across each other, and the arithmetic of remainders builds it in one line.
The inverse that spreads every difference
Change the input of a map on 8-bit words by a fixed amount and count how often the output changes by each amount. A random shuffle of the 256 words concentrates some differences: one input change produces one output change ten or twelve times. Taking the inverse in the field of 256 elements never does it more than four times. That is why the map sits at the heart of a widely used cipher. Whether any shuffle of 8-bit words can do it only twice is an open question.