Number puzzles reward experimentation, but experimentation is only the beginning. A few successful examples suggest a conjecture; they do not establish that the next example must work. The most satisfying solutions identify a structure that survives every allowed step. Mathematicians call such a preserved property an invariant. Sometimes the useful structure is even simpler: a pairing, a remainder, or the way digits encode place value.
One hundred lockers, one decisive observation
Imagine 100 closed lockers numbered 1 through 100. On pass one, you toggle every locker. On pass two, you toggle every second locker. On pass three, every third locker changes state. Continue through pass 100. Toggling means opening a closed locker or closing an open one. How many lockers are open at the end?
Do not simulate all 100 passes immediately. Focus on locker 12. It changes on passes 1, 2, 3, 4, 6, and 12: exactly the positive divisors of 12. Six changes return it to its original closed state. The puzzle is therefore not really about doors. It asks which positive integers have an odd number of positive divisors.
Your turn
Hint: pair the divisors
For each divisor d of n, pair it with n ÷ d. When can the two members of a pair be the same number?
Reveal the proof
Divisors normally occur in distinct pairs. A perfect square has one unpaired divisor, its square root. Only perfect squares have an odd divisor count, so lockers 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100 remain open.
This argument scales without extra bookkeeping. For N lockers, the number remaining open is the greatest integer not exceeding √N. That general statement is stronger than a list of ten successful outcomes. It also reveals the essential assumptions: every locker starts closed, every listed pass occurs once, and each visit toggles rather than simply opens.
The 1089 trick, without the mysticism
Choose a three-digit number whose first and last digits differ by at least two. Reverse it and subtract the smaller number from the larger. Treat the result as three digit positions, reverse it, and add. The result is 1089. A stage performer can present this as mind reading; place-value algebra gives a more interesting explanation.
Write the larger starting number as 100a + 10b + c, with a greater than c. Subtracting its reversal leaves 99(a − c). The middle digit b disappears entirely. Let d = a − c. Under the stated rule, d is one of 2 through 9. The three digits of 99d are d − 1, then 9, then 10 − d. Reversing those digits and adding produces 100 × 9 + 180 + 9, which is 1089.
The restriction matters. If the outer digits match, the subtraction gives zero. If they differ by one, the difference is 99, and the trick requires writing it as 099 before reversing. A careful solution states these conventions rather than hiding them after a counterexample. This is a useful habit whenever a puzzle involves digits instead of abstract integers.
Use remainders to shrink the search
Modular arithmetic tracks what remains after division. On a clock, adding twelve hours changes the elapsed time but not the displayed hour. In the same spirit, the last digit of a whole number tells us its remainder modulo 10. The language may sound advanced, but the underlying move is simply to forget information that the question does not need.
For example, can an integer square end in 2? Check the ten possible final digits of the original integer, from 0 through 9. Their squares end in 0, 1, 4, 9, 6, 5, 6, 9, 4, and 1. None ends in 2. This finite check is a proof because every integer belongs to one of those ten remainder classes. It is not the same as testing the first ten positive integers and hoping a pattern continues.
Euclid's Elements provides a historical foundation for divisibility arguments, while G. H. Hardy and E. M. Wright's An Introduction to the Theory of Numbers develops the subject much further. For recreational explorations, Martin Gardner's mathematical writing is a useful bridge between playful examples and rigorous questions. These are reading suggestions, not sources of an official difficulty ranking.
A repeatable number-puzzle routine
Begin with a small example and record what actually changes. Next ask whether parity, a remainder, a sum, or a divisor count controls the outcome. Translate the observations into symbols only when doing so makes the structure clearer. Finally, test the boundaries: zero, repeated digits, negative values, or a missing operation may invalidate an otherwise attractive claim.
When a numerical pattern looks inevitable, try to break it before announcing success. A single counterexample can disprove a universal statement. If no counterexample appears, explain why the cases you considered cover every possibility. That shift—from “it keeps happening” to “it cannot happen otherwise”—is where a number trick becomes mathematics.