TOPICS
Search

Locker Puzzle


The name locker puzzle is used for two different puzzles involving numbered lockers. In the toggling version, N lockers are initially closed. On pass k, for k=1, 2, ..., N, every locker whose number is a multiple of k is toggled, changing an open locker to closed or a closed locker to open. The problem asks which lockers remain open after all N passes (University of California, Riverside).

Locker j is toggled once for each positive divisor of j. Its final state is therefore open iff its number of positive divisors is an odd number. Pairing each divisor d with j/d shows that the pair members are distinct except when d^2=j. Thus exactly the square numbers remain open. There are |_sqrt(N)_| open lockers, where |_x_| is the floor function. For 100 lockers, the open numbers are 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100.

The locker puzzle of Curtin and Warshauer (2006) is instead the 100 prisoners problem, in which each prisoner searches a limited number of lockers for an assigned number. Its permutation strategy is distinct from the divisor pairing in the toggling puzzle.


Explore with Wolfram|Alpha

References

Curtin, E. and Warshauer, M. "The Locker Puzzle." Math. Intelligencer 28, 28-31, 2006. https://doi.org/10.1007/BF02986999.Numberphile. "The Light Switch Problem." Feb. 16, 2023. https://www.youtube.com/watch?v=-UBDRX6bk-A.University of California, Riverside. "Problem Set 4: Toggling Lockers/Train Problem." https://math.ucr.edu/~buli/MATH_002/MATH_002_HW4.pdf.

Cite this as:

Weisstein, Eric W. "Locker Puzzle." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/LockerPuzzle.html

Subject classifications