In a recent issue of Games Magazine the following question was posed:

There are 100 closed lockers in a school. Standing in front of each locker is a student. A bell will ring 100 times. At the first ring, all students will toggle their locker (from closed to opened). At the second ring, every other student will toggle his or her locker. At the third ring, every third student will toggle his or her locker, and so on, until the 100th ring where only the 100th student will toggle his/her locker. After the 100th ring, how many lockers will be open?

Now I wrote a program to determine the answer and it is quite intriguing. I'm wondering if anyone knows why the answer (which you'll have to figure out) is what it is, I needed the program but with time, I think I could have figured out the simple solution. I'll post the program in a couple of days unless someone else beats me to it.