An Open and Shut Puzzle
If you’ve never heard of the Locker Problem, it’s a puzzler that is sure to challenge your intellect. Like so many mathematical challenges that I enjoy, it’s simply stated, with a unique solution and a clear explanation. After you discover the answer, the more worthwhile activity is to figure out why. As I often said in my classroom, “The answer is often the least important part of the problem; knowing why we get that answer better prepares us for future solutions!”
Here it is: Consider a school with 1000 lockers, the doors to which are all closed at the start of the new academic year. Coincidentally, there are exactly 1000 students who are enrolled there! When the new school year begins, the first student walks by each locker and opens it. The second student then closes the even-numbered lockers. The third student goes to every third locker, shuts it if it is open and opens it if it is closed. The fourth student goes to every fourth locker, shuts it if it is open and opens it if it is closed. In this way, each nth student follows the pattern, thereby changing the status of each nth locker. After all 1000 students pass by all 1000 lockers, which ones remain open?
If you use a small sample, you might come up with the answer on your own. However, the important thing to consider is: why? Why should THOSE numbered lockers be the ones to be open at the end? To see the solution and explanation, scroll down a bit after the following illustration. Hope this was an intriguing pastime and that you look forward to more puzzlers!
ANSWER: Perfect squares
WHY? First of all, it should be clear that if a locker is touched an ODD number of times, it will be open. Secondly, when is a locker touched? When the student’s number is a FACTOR of the locker. That is, locker number 12 is touched by students # 1, 2, 3, 4, 6 and, finally, 12. Since that’s an even number of times, it will be closed in the end. Therefore, we’re looking for locker numbers which contain an ODD number of factors, like 36, whose factors are 1, 2, 3, 4, 6, 9, 12, 18 and 36 (i.e., two of its factors – 6 – are the same number). These are the PERFECT SQUARES. Simple and elegant – that’s Mathematics!
- Posted in: Mathematics ♦ Puzzlers
- Tagged: locker problem, Math, Mathematics, Number Theory, Recreations, Solution
Ok. so I have one locker at work, which is not visible when in the bathroom where it is located, and I have one locker at school, which, was not rightly assigned to me at the beginning of the term. When I go to work, a) how do I locate my locker? B) How do I discern between the correct combination for it and my school-locker? And c) where do I leave my school supplies in my diminutive work-locker? Still with me? OK, Additionally, when I go from work to school a) what public transportation ensures the most efficient route to my school locker? B) How do I not confuse my work-combo with my school combo? (Yes, this question must also be answered here, because in this context it takes on new social relevance.) And C) How do I use my school-locker when a club at the college is giving away free clothing and I am lucky enough to get a jacket, a shirt and a pair of sneakers- all of which fit me perfectly, now en-burdening me with an excess of clothing? (As was the case last Thursday.)
Too many esoteric questions for me. Remember, I’m retired, and so is my brain, but you do pose some interesting conundrums. Keep them coming!
I quite like reading a post that will make people think. Also, many thanks for permitting me to comment!
Arlene, YOU are Prime with me !
As are YOU, Gedempte!
Fun!! More, please!!
I got as far as running a short series, noticing the squares and then getting excited and coming back to read the explanation. (I’d like to think that given enough time and perhaps a bit more sleep I might have eventually figured it out on my own, but I just had to know now!)
So for makeup work, I wrote a small Python program to run the series for all 1000 lockers. At first, I thought there was a problem with the problem: the 1000th locker was open! Turned out to be a “one-off” error in the program, of course.
Not to waste all those minutes of coding, here’s the little guy’s output (first number is the index, second is the locker number, last number is the times opened or closed):
So glad this puzzle intrigued you….I was afraid too many would have already been familiar with it. How clever to run a program for the solution. Hope you had fun…..I did, reading your response!
I mentioned it to a friend, and he’d heard of it (but didn’t recall the “answer”) from a radio show of some sort. That version featured a hallway with lots of lights with pull chains. We looked up the transcript for their explanation, and it was indeed the same puzzle!
(And I always have fun whipping up a quick bit of code to dig into some interesting thing… part of the fun of being a programmer!)
Could the Radio Show have been “Car Talk?” I don’t recall hearing this as a puzzler on it, but it sounds like one they’d enjoy discussing!
It might be… that would be right up my buddy’s alley. What are the hosts’ names? I think at least one of them started with “F”…
Tom and Ray Magliozzi, otherwise known as “Click and Clack.”
I finally had a chance to ask my friend which show, and, yep, that’s the one! (I think in my head I was thinking “Frick and Frack”.)
I’m so glad that I got a reminder to check out your blog! This is wonderful. I’m not the most exacting, logical thinker, but I love reading about and working out problems. Thanks!
Thanks for looking; I think you’ll enjoy my non-math writings (check out “Say What?”). I look forward to reading more from you.