# 100 Locker Puzzle

394 views

You are standing in a school hallway lined with 100 closed lockers. You then open all 100 lockers. After this, you then close every 2nd locker (so the 2nd, 4th, 6th…98th and 100th are all closed). Then, you go to every third locker and open it if it is closed or close it if it is open (let’s call this toggling the locker for our discussion). You proceed to toggle every nth locker on pass number n. So, for example, on pass number 16 – you will toggle every 16th locker. After your hundredth pass of the hallway, in which you toggle only locker number 100, how many lockers are now open? In a hall with x lockers, how many lockers remain open after pass number x?

posted Jan 18, 2014

+1 vote

Only 10 lockers will remain open in case of 100 lockers.

Logic:
Let only 1 locker-
will end opened.

Let only 2 locker-
series:
open,open
close
Result: 1 is open

let 3 locker
series:
open,open,open
close
close
Result- 1 is open

let 4 locker
series:
o,o,o,o
c, c
c
0
Result: 1 and 4 will be open

.........................
...................
......................

similarly you can check for others
Only perfect squares will be opened between 1 and 100.