1. Suppose you’re in a hallway lined with 100 closed lockers
2. Begin by opening all 100 lockers.
3. Close every second locker.
4. Go to every third locker and close it if it is open, or open it if it is closed (call this toggling the locker).
5. Continue toggling every nth locker on pass number n.
6. Stop on your hundredth pass of the hallway when you will toggle only locker number 100.
How many lockers are open?

February 28, 2008 at 6:58 pm |
If you break each number into its factors, you will notice that most (90, in fact) of the lockers have an even number of factors (e.g. 12 is 1*12, 2*6, 3*4). Since the number of factors is even, so are the toggles (odd toggles open the lockers, even toggles close the lockers). The only lockers that remain open are the perfect square lockers (1,4,9,16,25,36,49,64,81,100), because these are the only numbers with an odd number of factors (e.g. 64 is 1*64, 2*32, 4*16, 8^2–the 8 is only counted once because there is only one 8th pass). Thus, there are 10 lockers open after 100 passes.
October 9, 2009 at 4:14 pm |
So how did you calculate that? Using a calculator? Or your brains??