There is a circular jail with 100 cells numbered from 1 to 100. One night the jailor gets drunk and starts running around the jail in circles. In his first round he opens every door. In his second round he visits every 2nd door (2,4,6,...) and shuts the door. In the 3rd round he visits every 3rd door (3,6,9,...) and if the door is shut he opens it, if it is open he shuts it. This process of crazy drunken-ness continues for 100 rounds and finally the jailor gets exhausted and falls down. Let us assume the prisoners are all kind enough to wait until the crazy jailor stops and finally they decide to escape. By the end of all this, how many prisoners find their doors open?
Login to submit your solution