This article is from the Puzzles FAQ, by Chris Cole firstname.lastname@example.org and Matthew Daly email@example.com with numerous contributions by others.
In article <5840002@hpesoc1.HP.COM>, nicholso@hpesoc1.HP.COM (Ron Nicholson) writes:
> Say that we have a hallway with n lockers, numbered from sequentialy
> from 1 to n. The lockers have two possible states, open and closed.
> Initially all the lockers are closed. The first kid who walks down the
> hallway flips every locker to the opposite state, that is, opens them
> all. The second kid flips the first locker door and every other locker
> door to the opposite state, that is, closes them. The third kid flips
> every third door, opening some, closing others. The forth kid does every
> fourth door, etc.
> After n kid have passed down the hallway, which lockers are open, and
> which are closed?
B4. (a) Kids run down a row of lockers, flipping doors (closed doors
are opened and opened doors are closed). The nth boy flips every nth
lockers' door. If all the doors start out closed, which lockers will
remain closed after infinitely many kids?
B4. (a) Only lockers whose numbers have an odd number of factors will remain
closed, which are the squares.