Here is the famous locker problem: Imagine you are at a school that has 100 lockers, all shut.
- Suppose the first student goes along the row and opens every locker.
- 2. The second student then goes along and shuts every other locker beginning with
locker number
2.
- 3. The third student changes the state of every third locker beginning with
locker number 3. (If
the locker is open the student shuts it, and if the locker is closed the student opens it.)
-
4. The fourth student changes the state of every fourth locker beginning with
number 4.
Imagine that this continues until the 100 students have followed the pattern with the 100
lockers. At the end, which lockers will be open and which will be closed? Which lockers have
been switched the most often? How many lockers, and which ones, were touched exactly five
times?
Instructions.
Use this applet to explore. Begin by clicking the "Next Student Go" button to see what happens
after the 1st student goes, then click again to see what happens when the 2nd student goes,
and keep going. If you want to do it manually, enter a number in the box at the top of the
applet. If you enter a "4" then the applet will change the state of every 4th locker starting
with number 4.