I think Truce is right.
There are exactly 500 doors open at the end.
Just look through the first few iterations of it:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 1
1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 0
Here 1 means open and 0 means closed.
Note that from the second line on, exactly half are open and exactly half are closed. This will remain true for the entire pattern.
Unfortunately, you have not expressed all of the factors of all of the first 16 positive integers. You have to go through as many iterations as there are lockers. Also, you screwed up a bit in your counting.
01 - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
02 - 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0
03 - 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0
04 - 1 0 0 1 1 1 1 1 0 0 1 0 1 0 0 1
05 - 1 0 0 1 0 1 1 1 0 1 1 0 1 0 1 1
06 - 1 0 0 1 0 0 1 1 0 1 1 1 1 0 1 1
07 - 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1
08 - 1 0 0 1 0 0 0 0 0 1 1 1 1 1 1 0
09 - 1 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0
10 - 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 0
11 - 1 0 0 1 0 0 0 0 1 0 0 1 1 1 1 0
12 - 1 0 0 1 0 0 0 0 1 0 0 0 1 1 1 0
13 - 1 0 0 1 0 0 0 0 1 0 0 0 0 1 1 0
14 - 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0
15 - 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0
16 - 1 0 0 1 0 0 0 0 1 0 0 0 0 0 0 1
As predicted by Truce, square numbers 1 4 9 and 16 appear.