The Locker Puzzle

Logic Level 2

Suppose you're in a hallway lined with 100 closed lockers. You begin by opening every locker. Then you close every second locker. Then you go to every third locker and open it (if it's closed) or close it (if it's open). Suppose you continue doing this to every nth locker on pass number n. After 100 passes, where you toggle only locker #100, how many lockers are open?

For a better visual : During the 3rd time you open/close(whatever maybe the case) locker number 3,then locker number 6 and so on until locker 99.The 4th time you do the same i.e:4th locker,then 8th locker....and so on.


The answer is 10.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Arkin Dharawat
Aug 26, 2015

The answer is 10.These 10 lockers are none other than the square numbers till 100,i.e: 1 , 4 , 9 , 16 , 25 , 36 , 49 , 64 , 81 , 100.

The thinking goes in the way that locker numbers with an odd number of factors will always be open and those with an even number of factors will always be closed.Taking number 60 and 36 as examples:

60:- 1 , 2 , 3 , 4 , 5 , 12 , 15 , 20 , 30 , 60.

The above can also be written as :open , close , open , close , open , close , open , close , open , close . As you can see it will be closed . of it.

36:- 1 , 2 , 3 , 4 , 6 , 9 , 12 , 18 , 36.

Looking at the above: open, close , open , close , open , close , open , close, open. As you can see the locker will be open and this likewise will happen for all square numbers. Therefor 10 is the answer.

did the same. try the odd demon question just after you do this one.

Ajinkya Shivashankar - 4 years, 8 months ago
Pranjal Prashant
Aug 26, 2015

arkin, I was just going to post the soln. but suddenly saw you doing that one min. before me. yes, its quite right, all the terms which are perfect squares will have their divisors leaving the lockers open. same is true for any number. I had solved earlier for 1000, it was 31 :)

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...