Question 134918
A locker will change state whenever the ordinal number of the student passing evenly divides the number of the locker.  So, if there are an even number of even divisors, counting 1 and the number of the locker itself, (i.e., student 33 in front of locker 33), then the state of the locker will be the same as its state at the beginning.  On the other hand, if there are an odd number of divisors, then the state will change an odd number of times and the state of the locker will be opposite to the state at the beginning.


So if a number has a an even divisor, then there is a quotient that is also an even divisor.  For example, 6 divided by 2 is 3, and 6 divided by 3 is 2.  Therefore, even divisors always come in pairs EXCEPT for perfect squares.  Perfect squares have one divisor, namely the square root of the perfect square, that gives a quotient that is the same number as the divisor, hence that divisor can only be counted once.  So perfect squares have an odd number of divisors, and every other positive integer has an even number of divisors.


That means that if every locker is open at the start, the lockers with numbers that are perfect squares, (1, 4, 9, 16...) will be closed, and the rest will be open.