Remember all of those lockers in high school, running to them to get them open between classes, dreading the ringing of the bell. What if someone was opening and closing them while you were in class?
Imaging that you have 1000 lockers that are initially closed and you
have 1000 pranksters. The first person
changes that state of every
locker: if it is open he closes it, and if it is closed he opens it. So, the first person will open every locker.
The second person changes the state of every
2nd locker. In other words, he
now closes every other locker starting with the second. The third
person
changes the state of every third locker.
This repeats up until the 1000th person.
How many lockers are now open?