# Puzzle 76 | Toggling prison cell

There was a prison consisting of 1000 cells numbered from 1 to 1000.

- Each cell can be marked with ‘+’ or ‘-‘sign. Initially, all cells were marked with ‘-‘ sign.
- From days 1 to 1000,the jailor toggles marks on the cell from + to – or vice versa.
- On the i-th day ,the signs on cells that are multiples of i get toggled.
- Now in the process of verification on 1001-th day, all cells marked with + signs are opened.

Can you identify the cell numbers with ‘+’ sign?

**Solution:** Cell numbers are 1, 4 ,9, 16, 25, 36 and so on.

**Explanation:**

A cell gets toggled as many times as the number of divisor it has. For example let’s take cell number 20, it gets toggled on days 1, 2 ,4, 5, 10 and 20.

- Now we can see that divisors come in pairs like 20=1*20=2*10=4*5. We can see that total number of divisor is even. But this trend is not followed if the number is a perfect square.
- In perfect square , total number of divisors is odd. We see that cells are initially marked with – sign and only cell numbered as perfect square gets changed to + sign as it is having odd number of divisors.

These cells are** 1, 4 ,9, 16,25,36,49 and so on.**

This puzzle is contributed by **Ankur Chaudhary.** Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

## Recommended Posts:

- Puzzle 1 | (How to Measure 45 minutes using two identical wires?)
- Puzzle 2 | (Find ages of daughters)
- Puzzle 3 | (Calculate total distance travelled by bee)
- Puzzle 4 | (Pay an employee using a 7 units gold rod?)
- Puzzle 13 | (100 Prisoners with Red/Black Hats)
- Puzzle 5 | (Finding the poisoned wine)
- Puzzle 6 | (Monty Hall problem)
- Puzzle 7 | (3 Bulbs and 3 Switches)
- Puzzle 8 | (Find the Jar with contaminated pills)
- Puzzle 9 | (Find the fastest 3 horses)
- Puzzle 10 | (A Man with Medical Condition and 2 Pills)
- Puzzle 11 | (1000 Coins and 10 Bags)
- Puzzle 12 | (Maximize probability of White Ball)
- Puzzle 14 | (Strategy for a 2 Player Coin Game)
- Puzzle 15 | (Camel and Banana Puzzle)