Tuesday, July 04, 2006

Coffee Time puzzle #2

In continuation to the coconut problem , I posted , here is another one.

Vivek keeps flummoxing me with these puzzles....

Anyone try this ?


There is a prison with n cells. All the cell doors are in the closed state.
On the first day, they are all opened. On the second, all multiples of 2 toggle their state (cells 2,4,6...close). On the 3rd day, all multiples of 3 toggle their state (those which were open now close and those closed open). This goes on for n days. After the nth day what would be the state of the cell doors and why?

5 comments:

test123 said...

Prime numbered cells will be closed.
The state of the composite numbered cells depends on the number of its unique factors. Was that the answer or was there a better solution?

sudeep said...

I figured out prime numbers will be closed....Couldnt guess the state of the composite numbered cells....

Avi said...

This is an infy puzzle. Look up shakuntala devi for more details. :-)

sudeep said...

heheh...The way you branded it as an "infy puzzle" was hilarious ...Maybe Shakuntala Devi will crack the full Infy test and we should make her the CEO of infy

Enigma said...

ok whts the answer