The hundred lockers
A long hallway has 56 doors, numbered 1 to 56, all closed. Person 1 opens every door. Person 2 changes every second door, person 3 every third, and so on to person 56 — person k changes every door whose number k divides.
In the end, how many doors are left open?
Open only where the count of divisors is odd
- There are 56 doors in a row, all closed to start with.
- Each door numbered L is changed once for every number that divides L — once per divisor of L. Divisors come in pairs, d with L ÷ d, so the count is even and the door ends closed.
- Except for a perfect square: its square root pairs with itself, so it has an odd number of divisors and ends open. So the doors left open are exactly the perfect squares up to 56: 1, 4, 9, 16, …, 49.
- Count them: 1×1, 2×2, and so on up to 7×7 = 49. That is 7 of them, so 7 doors are left open.
How it works.
- 01
There are 56 doors in a row, all closed to start with.
- 02
Each door numbered L is changed once for every number that divides L — once per divisor of L. Divisors come in pairs, d with L ÷ d, so the count is even and the door ends closed.
- 03
Except for a perfect square: its square root pairs with itself, so it has an odd number of divisors and ends open. So the doors left open are exactly the perfect squares up to 56: 1, 4, 9, 16, …, 49.
- 04
Count them: 1×1, 2×2, and so on up to 7×7 = 49. That is 7 of them, so 7 doors are left open.