A Classic Computer Science Puzzle
There are 100 doors in a hallway, all initially closed.
A person walks through the hallway 100 times. On the first pass, they toggle every door (1, 2, 3, ..., 100). On the second pass, they toggle every second door (2, 4, 6, ..., 100). On the third pass, every third door (3, 6, 9, ...), and so on.
Question: After all 100 passes, which doors remain open?
Answer: Only the perfect squares (1, 4, 9, 16, 25, 36, 49, 64, 81, 100) remain open, because perfect squares have an odd number of divisors.