There are 100 doors. 100 strangers have been gathered in the adjacent room. The first one goes and opens every door. The second one goes and shuts down all the even numbered doors – second, fourth, sixth... and so on. The third one goes and reverses the current position of every third door (third, sixth, ninth… and so on.) i.e. if the door is open, he shuts it and if the door is shut, he switches opens it. All the 100 strangers progresses in the similar fashion.
After the last person has done what he wanted, which doors will be left open and which ones will be shut at the end?
Solution:
Think deeply about the door number 56, people will visit it for every divisor it has. So 56 has 1 & 56, 2 & 28, 4 & 14, 7 & 8. So on pass 1, the 1st person will open the door; pass 2, 2nd one will close it; pass 4, open; pass 7, close; pass 8, open; pass 14, close; pass 28, open; pass 56, close.
Thus we can say that the door will just end up back in its original state for each pair of divisor. But what about the cases in which the pair of divisor has analogous number for example door number 16? 16 has the divisors 1 & 16, 2 & 8, 4&4. But 4 is recurrent because 16 is a perfect square, so you will only visit door number 16, on pass 1, 2, 4, 8 and 16… leaving it open at the end. So only perfect square doors will remain open at the end.