Nerds, Jocks, and Lockers
in Bring Your Own Code
Mr. Zargas was the zany math teacher at Cliffmont High that everyone seemed to love. Whether you were a nerd or a jock, he made mathematics interesting, challenging, and fun to learn. That, in and of itself, was impressive enough, but Mr. Zargus took it one step further. When it came time for his frequent "Mathematical Battle of Wits," he would let the jocks use their brawn instead of their brains. The nerds never stood a chance, especially when it came to his "locker challenge."
The rules of Mr. Zargas' locker challenge were simple. Corridor G was a long-since abandoned section of Cliffmont High that a row of 100 unused, empty lockers. If you "toggled" the state of each locker (i.e. opening it if its closed, closing it if its open) in the following manner, which lockers would remain open?
- Every single locker is toggled (since all lockers start closed, this means each one is opened).
- Every other locker is toggled (in this case, closed), starting with the second.
- Every third locker is toggled, starting with the third.
- Every fourth locker is toggled, starting with the forth.
- The hundredth locker is toggled.