Open Doors in an Empty Prison!
Read the story behind the title!
Let's take few cells into consideration as representatives.
The warden visits cell no. 5 twice - 1st & 5th trip.1 & 5 are only divisors of 5.
He visits cell no. 10, on 1st, 2nd, 5th, 10th trips i.e. 4 times. Here, divisors of 10 are 1,2,5,10.
He stops cell no. 31 only twice i.e. on 1st and 31st trip.
He visits cell no.25 on 1st, 5th, 25th trips that is thrice.
In short, number of divisors that cell number has, decides the number of visits by warden.
For example, above, cell no.5 has 2 divisors hence warden visits it 2 times while 10 has 4 divisors which is why warden visits it 4 times.
But when cell number is perfect square like 16 (1,2,4,8,16) or 25 (1,5,25) he visits respective cells odd number of times. Otherwise for all other integers like 10 (1,2,5,10) or like 18 (1,2,3,6,9,18) or like 27 (1,3,9,27) he visits even number of time.
For prime numbers, like 1,3,5,....31,...97 he visits only twice as each of them have only 2 divisors. Again, number of visits is even.
Obviously, the doors of cells to which he visits even number of times will remain closed while those cells to which he visits odd number of time will remain open.
So the cells having numbers that are perfect square would have doors open. That means cells 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100 would be having their doors open.
Comments
Post a Comment