At a school, there are 1000 students and 1000 lockers, one for each student. For homecoming they do a ritual where they line up in one line and do the following: The first student walks by each of the lockers and opens all of them, in order from 1 to 1000. The second student walks by each locker and closes every second locker. The third student walks by and changes the "state" of the third locker. (if it was closed they opened it. if it was opened they closed it.) The fourth person changed the state of every 4th locker and the fifth student changed the "state" of every fifth locker. Everyone continues to do so until the 1000th student goes.


I've tried drawing it out but I really don't see a pattern. I know that when x locker and x student meet up, that one will stay in the stage it is. like student 13 and locker 13 will remain closed. please help!