#123easyBrainteasers
The Locker Problem
Problem
Imagine a long hallway containing 100 lockers, all initially closed. One hundred students walk down the hallway one at a time and each follows a simple rule:
- Student 1 toggles (opens if closed, closes if open) every locker: 1, 2, 3, ..., 100.
- Student 2 toggles every 2nd locker: 2, 4, 6, ..., 100.
- Student 3 toggles every 3rd locker: 3, 6, 9, ..., 99.
- In general, Student k toggles every k-th locker.
After all 100 students have walked the hallway, which lockers are left open? How many are there?
Loading interactive editor…