A jail has 100 cells, numbered 1 to 100. The king Declares some sort of amnesty and orders the following. step 1: make sure all Cells are closed step2: reverse (if open, close; if close, open) those Cells whose numbers are divisible by 1 (in this step, all cells will be Opened); step 3: reverse those that are divisible by 2 (in this step, All even numbered cells will be closed); step 4: reverse those that are Divisible by 3; step 5: reverse those divisible by 4; step 6 to step 101: and so on . . . step 102: release the prisoners in those cells which are finally Open. How many prisoners will be released, and from which cells?

This question is related to Infosys Interview

Showing Answers 1 - 12 of 12 Answers


  • May 26th, 2005

Result: All those squares below 100 are set free. Like 4,9,16, 25, etc etc 
Solution: If we start with a number, like 6, It has factors 2 & 3 which form a pair. So if the jail is set free with 2, it gets closed with 3. But if we take a squared number like 16, it has factors 2, 4, 8 which means that there is a single factor called 4 with which the result can be achieved.


  • Aug 8th, 2005

correct! the logic is all numbers having odd no. of factors will be opened........all squares have odd no. of factors 

  Was this answer useful?  Yes


  • Sep 1st, 2005

ans 9

  Was this answer useful?  Yes


  • Sep 24th, 2005


  Was this answer useful?  Yes

Nitika Gupta

  • Sep 29th, 2005

The even numbered cells will be open and odd numbered cells will be closed.

  Was this answer useful?  Yes


  • Sep 29th, 2005

The answer is 1**2 , 2**2 , 3**2 4**2 5**2 6**2 e.t.c

i.e 1,4,9,16,25,36,49,64,81,100

  Was this answer useful?  Yes


  • Mar 20th, 2006

1)all closed

2)all opened(100)

3)50 opened(odd) and 50 closed(even)

4)17 closed(odd),33 opened(odd) & 16 opened(even),34 closed(even)

5)17 closed(odd),33 opened(odd) & 8closed,8opened,17 closed,17 opened

therefore 33+8+17=58 opened.....so obviously 58 out of 100 will be released..

  Was this answer useful?  Yes

Sonali Panda

  • Apr 12th, 2006

2.All wiil b Open

3.50 wiil b open ,50 wiil b closed

4.as the no divisible by 2 is not divisible by 3(50 remain open)+33 will be open,ie 83

5.no divisible by 2 will b divisible by 4 =25,so 25 will b closed,so 83-25=58 will b opened

6 to 101 the same,so in 100 times 58 will be open,101(opposite of100),so 42 will be opened,so 102 58 will be opened

ANS:-58 person will be released


  • Jul 30th, 2006

ans is 10 (not 9)i am sure the cell no 1 is open in step 2 and is still b open upto last step.so tat is also included.ans is 10 i am sure about tat

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions