The School Has 1000 Lockers Numbered 1 To 1000 For Each Student On The First Day

The school has 1000 lockers, numbered 1 to 1000 for each student. On the first day of school, all 1000 lockers are closed and all 1000 students are outside waiting to be let into the building. The first student enters and opens all of the lockers. The second student follows and closes every second locker, beginning with the second locker. The third student enters the school and reverses every third locker beginning with locker 3 (i.e., if the locker is closed it is opened and vice versa). This procedure is continued until all 1000 students have passed by all the lockers. When they finish, which lockers will be open?