When I see problems like this, I always start with smaller, simpler problems to see if a pattern emerges. Often it does. This time I am not sure, but this is what I have done so far. Start with one student and one locker; then two and two, and so on. Let a 0=open locker, and 1=closed locker.
So for one student and one locker the result is 0.
For two students and two lockers, after the first student the result is 00, and after the second student the result is 01.
For three and three, 000 010 011.
For four and four, 0000 0101 0111 0110.
For five and five, 00000 01010 01110 01100 01101
Six and six, 000000 010101 011100 011000 011010 011011
If you look at the end results for this series of 1 to 6 you see this sequence:
0, 01, 011, 0110, 01101, 011011. What you can see is that the nth student does not alter the first n-1 lockers, only the nth locker. The problem is to see what the n-1 students did to that nth locker before the nth student gets there. I did this up to nine and nine. It gets tricky and easy to make mistakes, but I did not see a pattern.
I tried looking at the end positions as binary numbers, hoping to see a pattern.
This is what I see: 0, 1, 3, 6, 13, 28. So far, no dice.