Locker Counting

There are 1000 lockers numbered 1 to 1000. Suppose you open all of the lockers, then close every other locker starting with the one labeled 2. Then, starting with locker 3, for every third locker, you close each opened locker and open each closed locker. You follow the same pattern for every fourth locker starting with locker four, every fifth locker starting with locker five, and so on up to every thousandth locker. Which locker doors will be open when the process is complete? Justify your answer.