There are n lockers in a hallway, numbered sequentially from 1 to n. Initially all the locker doors are closed. You make n passes by the lockers, each time starting with locker 1.
On the ith path, i = 1,2,…n you toggle the door of every ith locker; if the door is closed, you open it; if it is open, you close it.
After the last pass, which locker doors are open and which are closed? How many of them are open?