A school has a hallway with 100 lockers. All the lockers are closed.
A student walks down the hallway can opens every locker. A second student walks down the hallways and closes every second locker, starting at locker 2. A third student then walks down the hallways and changes the state of every third locker, starting at locker 3.
The
After 100 students have passed down the hallway, which lockers are open?
The lockers left open are the square numbers: 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100.
Proof
The lockers that are left open are those that have been changed an odd number of times.
Since student
Factors come in pairs (