Skip to content

← Articles

The Lockers That Refuse to Close

A hundred doors, a line of students, and a counting argument that explains why only the perfect squares stay open.

A long school corridor of identical locker doors fading into bright light, with a scattered pattern of doors standing open and glowing warm while students walk past in motion.
A corridor of lockers, with the open doors falling at the perfect-square positions after every student has passed.

Imagine a corridor with one hundred lockers and a line of students moving down it. The first student touches every door. The second touches every other door. The third touches every third door, and so on, until student one hundred reaches only the last locker. Each touch flips a locker’s state: open becomes closed, closed becomes open. At the end, ten doors remain open, and their numbers make a pattern that feels almost too neat: 1, 4, 9, 16, 25, 36, 49, 64, 81, 100.

A long school corridor of numbered locker doors fading into bright light, a few open with warm glow while students walk past in motion.
A row of numbered locker doors, with the first ten perfect-square positions marked for attention.

The row and its quiet rule

The puzzle asks us to keep track of many small actions without losing the rule that governs them. A locker is touched by the students whose numbers divide evenly into its number. Locker 5, for instance, is visited by student 1 and student 5, because those are its factors. It opens on the first pass, then closes on the fifth.

That example is easy to hold in mind. The whole row is harder. By the time the hundredth student has passed, trying to remember every door’s history is a poor use of attention. The puzzle is asking for a change of scale: stop following each student’s route and look at the number of times a particular locker is touched. A solution account from 36 University points toward that factor-counting approach, while the Braingle version states the same central pattern.

The final state depends on whether a locker is toggled an even or odd number of times. Two touches cancel: one opens it, the next closes it. Three leave it open; four leave it closed. The corridor’s long sequence of footsteps reduces to a single question for each door: how many factors does its number have, and is that count odd or even?

Where the factor pairs break

For most numbers, factors arrive in pairs. Locker 10 has the pairs 1 and 10, 2 and 5. Each pair contributes two visits, so the total is even. We can follow the actual switches: student 1 opens locker 10, student 2 closes it, student 5 opens it, and student 10 closes it. Four touches, closed at the end.

This pairing suggests an elegant but incorrect first guess: if factors come two at a time, every locker gets an even number of touches and every door ends shut. The reasoning works right up to the point where the number has a factor that pairs with itself. For 25, the factors are 1, 5, and 25. The outer factors pair, 1 with 25, but 5 is left in the middle because 5 multiplied by itself is 25.

That lone factor changes the count from even to odd. Student 1 opens locker 25, student 5 closes it, and student 25 opens it again. The door stays open. The apparent exception is not an interruption of the rule. It is the place where the rule becomes visible: a perfect square has a square root that meets itself in the factor list.

Counting the passes without walking them

Locker 40 makes the contrast plain. Its factors are 1, 2, 4, 5, 8, 10, 20, and 40. Those are eight visits, so the locker finishes closed. The list can be arranged in pairs: 1 with 40, 2 with 20, 4 with 10, and 5 with 8. No factor is left over.

For any number that is not a perfect square, each factor has a distinct partner. If a factor is called d, its partner is the number divided by d. The two multiply to make the locker number. A non-square cannot have a factor equal to its own partner, so every factor belongs to a two-member pair. Its total number of factors must be even.

A square is different because its square root is its own partner. For 36, for example, 6 multiplied by 6 gives 36. The other factors pair off, but 6 occupies the shared middle point. That leaves an odd total. Since an odd number of toggles leaves a locker open, the open doors are exactly the perfect squares. The source accounts state this odd-factor rule; the pairing argument supplies the missing proof.

A long, quiet school corridor with rows of closed metal lockers fading into the distance, a few doors slightly open with warm light spilling out, and a lone student reflected in the polished floor.
The factor list for a square, with its square root standing alone between paired factors.

Two routes into the pattern

There are two useful ways to approach the puzzle. One is to shrink it. Try twenty lockers, write down which remain open, and see whether their numbers suggest a pattern. Small cases make the toggling visible without asking the reader to manage one hundred doors at once. The danger is stopping at the pattern and treating a few examples as proof.

The other route is to choose a locker and trace its factors. This gives a direct audit. Locker 10 has four visits. Locker 25 has three. Locker 40 has eight. The counts explain those particular endings, then the factor-pair argument explains every locker in the row. Experiment gives the eye something to notice; proof shows why the pattern cannot fail.

Return to the corridor after the last student has passed. Most doors are shut, not because the movement has become mysterious, but because their visits have canceled in pairs. Ten numbers keep a remainder: each is a square, each has one factor that meets itself, and each records that unpaired touch in its final open position.

Sources

Lila Serrano

An exceptional writer at Deeperpectives, she covers public memory, family archives, and the histories held in ordinary objects. Before joining the desk, she cataloged oral histories for a neighborhood museum, where she learned to treat a small detail as a door, not a conclusion.

Keep reading.

Puzzles · Nov 1, 2026

Einstein's Riddle: The Legend and the 1962 Magazine Page

The famous five-house logic puzzle has no documented link to Einstein. Its earliest known appearance is a 1962 issue of Life International, and its author is still unknown.

By Siobhan O'Reilly

Paradoxes · Nov 1, 2026

The Jam Table Problem and the Limits of a Famous Experiment

A 2000 study of tasting booths became a case for choosing less, but the wider evidence points to something more conditional.

By Marcus Adeyemi-Holt

Paradoxes · Nov 1, 2026

A Shortcut That Slows Everyone: Braess's Paradox and the Limits of the Map

A small traffic model shows how a new connector can leave every driver worse off, and why the result is a reason to ask harder questions about road proposals rather than a verdict on any particular road.

By Lila Serrano

The Lockers That Refuse to Close | Deeperpectives