Open In App

Puzzle 76 | Toggling prison cell

Improve
Improve
Like Article
Like
Save
Share
Report

 

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.


Last Updated : 18 Jan, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads