There are one hundred closed lockers in a hallway. A man begins by opening all one hundred lockers. Next, he closes every second locker. Then he goes to every third locker and closes it if it is open or opens it if it is closed (e.g., he toggles every third locker). After his one hundredth pass in the hallway, in which he toggles only locker number one hundred, how many lockers are open?

**My initial thoughts (Solutions):**

Before the 1st pass, all the lockers are closed. To remain open in the end, the locker must be toggled odd number of times. Let us then think about it: when will closer i be toggled? It depends on the factors of i. For example, if i = 6, since the factors of 6 are 1, 2, 3 and 6. It will be toggled at the 1st, 2nd, 3rd and 6th passes. As a result, it will be closed after 100 passes. Therefore, all the lockers with odd number of factors will be open in the end. What are the numbers with odd number of factors? From cant-remember-name theorem, the number of factors of number is given by . To make this number odd, you must have for any . That is, is even for all . What does that mean? That means n is a perfect number! So, how many perfect numbers are there from 1 to 100? 10 of them. Therefore, after the 100th pass, we will have 10 lockers open.

### Like this:

Like Loading...

*Related*

kelsoking

Jun 24, 2012@ 00:29:06I agree that there are ten lockers open but aren’t familiar with whats-it-called theorem. I thought of the solution as the numbers that are squares, have an odd number of distinct factors, so 1 squared, 2 squared, up to 10 squared. These numbers can have other factors, but they are in pairs, e.g. 4 squared is also 2 x 8. Probably exactly what you’re saying but I thought the squaring thing was worth mentioning.

Runhe Tian

Jun 24, 2012@ 00:34:06Absolutely correct. Thanks for the addition!

oshin choudhary

May 24, 2013@ 00:36:14what about prime nos?!?!

oshin choudhary

May 24, 2013@ 00:33:35what about prime nos?!?! and btw 1 will not be open!! so there are 9 + prime nos!!