SOLUTION:
Only perfect square doors will be open at the end.
For example, after the first pass every door is open. on the second pass you only visit the even doors (2,4,6,8…) so now the even doors are closed and the odd ones are opened. The third time through you will close door 3 (opened from the first pass), open door 6 (closed from the second pass), etc..
Question: What state are the doors in after the last pass? Which are open which are closed?
Solution: You can figure out that for any given door, say door #42, you will visit it for every divisor it has. So 42 has 1 & 42, 2 & 21, 3 & 14, 6 & 7. So on pass 1 i will open the door, pass 2 i will close it, pass 3 open, pass 6 close, pass 7 open, pass 14 close, pass 21 open, pass 42 close. For every pair of divisors the door will just end up back in its initial state. So you might think that every door will end up closed? Well what about door #9. 9 has the divisors 1 & 9, 3 & 3. But 3 is repeated because 9 is a perfect square, so you will only visit door #9, on pass 1, 3, and 9… leaving it open at the end. Only perfect square doors will be open at the end.