Toggling Prison Cell Puzzle

Toggling Prison Cell Puzzle

This is a Toggling Prison Cell puzzle. There are 1000-cell in a prison with numbers ranging from 1 to 1000.

  • Premise – A ‘+’ or a ‘-‘ sign can be placed in each cell. All cells were initially designated with a ‘-‘ sign.
  • Rules – The jailor toggles and marks the cells from positive {+} to negative {-} or vice versa from day 1 to 1000. The signals on cells that are multiples of I are toggled on the i-th day. On the 1001st day, all cells that are indicated with plus {+} signs are now opened for the verification procedure.
  • Objective – How are you going to recognize the cell numbers that are with a plus ‘+’ sign?
Toggling Prison Cell puzzle.

The solution to Recognize the Cell Numbers

Cell numbers include 1, 4, 9, 16, 25, 36, and so on.

  • The number of times a cell is toggled is equal to the number of divisors it has. Let us take an example, cell number 20, which is toggled on days 1, 2, 4, 5, 10, and 20.
  • We can now see that divisors are found in pairs, such as 20=1*20=2*10=4*5.
  • The total number of divisors is even, as can be seen.
  • If the number is a perfect square, though, this tendency is broken.
  • The total number of divisors in a perfect square is odd.

Therefore, the cells that are initially marked with a negative {-} sign, except the cell, numbered as a perfect square, which is marked with a + sign because it has an odd number of divisors.

Prime Course Trailer

Related Banners

Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription

Get over 200+ course One Subscription

Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others

Checkout list of all the video courses in PrepInsta Prime Subscription

Checkout list of all the video courses in PrepInsta Prime Subscription