100 students toggle 100 lockers in turn. Which ones are left open at the end?

A row of 100 closed lockers, numbered 1 to 100, sits in a hallway. Student 1 walks down the row and opens every locker. Student 2 then toggles every 2nd locker (closing locker 2, 4, 6, and so on). Student 3 toggles every 3rd locker, student 4 every 4th, and so on until student 100 toggles only locker 100. After all 100 students pass through, which lockers are left open?

Reveal the answer

Exactly the perfect-square lockers: 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100. A locker gets toggled once for every divisor its number has, and divisors pair up neatly except when a number is a perfect square, since its square root only counts once (for locker 36, the pair 6x6 contributes a single unmatched toggle alongside pairs like 1x36, 2x18, 3x12, 4x9). An odd number of toggles leaves a locker open, and only perfect squares have an odd number of divisors.

— Traditional mathematics competition puzzle, Locker puzzle — Widely circulated in American math olympiad and puzzle collections since the mid-20th century

One credited idea per card. No filler. Swipe the rest in Savvy.

Keep swiping — it's free Works right in your browser. No app store needed.

More Puzzles

All Puzzles cards →

Five ideas worth knowing, every week

The week's best cards and a puzzle, credited as always. Free, unsubscribe any time.