Search Results:
- Take the all of the square numbers and those are the ones that remain open. This holds true because when the lockers are touch the only lockers that remain open are the ones touched an odd number of times.
- Locker 2 by 2 students 1,2. Locker 3 by 2 students 1,3. Locker 4 by 3 students 1,2,4. Locker 5 by 1 student 1. Locker 6 by 3 students 1,2,3. Locker 7 by 1 student 1. Locker 8 by 3 students 1,2,4. Locker 9 by 2 students 1,3. Locker 10 by 2 students...
- And how many times would a switch have to be flipped to be on at the end? Person 1 starts at locker 1 and opens every locker. Person 2 starts at locker 2 and closes every 2nd locker. Person 3 starts at locker 3 and changes every 3rd locker. Person 4 starts at locker 4 and changes every 4th locker. Person x starts at locker x and changes every xth locker. I need to figure out which lockers are left open in a row of 25, , and a row of lockers. I have been trying to figure this out for 4 days and my parents can not figure it out either. I don't know what number person x is. My parents say this has nothing to do with math. Can you help? Clearly this is intended to be solved by trying a small example and extending it, rather than by seeing it all at once.
- There were already several complete solutions in the archive, but I chose to offer some suggestions to help Michael discover a solution himself, rather than just give a link: It has a lot to do with math! But I'm not sure whether everyone your age can be expected to figure out the complete answer on his own. You may be expected only to recognize a pattern, but there is a lot of very interesting math if you look deep enough. It sounds like a lot of your confusion is over the 'x' part, so maybe the problem wasn't made fully clear.
- Usually in this problem it's a classic, by the way , the number of people is the same as the number of lockers in the hallway. So what they mean by 'person x' is all the people from person 1 up to the last person. In other words, if there are 10 lockers there are 10 people, and the pattern continues from person 1 up through person If there are lockers, there are people and each of the goes through the hallway turning lockers that are multiples of their own number. Does that help? Michael may not yet be fully accustomed to using variables, or may think x must be a specific number to be solved for.
- If I were you, I would first try "playing" with the problem with a small number of lockers, like 25 so you can see what the whole thing means. Do you follow what I did, and understand how the problem works? The idea is that each person opens or closes only the lockers that are a multiple of his number: 2 changes the multiples of 2, 3 changes the multiples of 3, and so on up to person x, the last one to go through. There are many ways you might write out your work; I chose a way that requires less writing than some, while keeping all the information visible.
- Each column represents what that person does. The first person opened them all; the second closed 2, 4, 6, 8, and 10; the third opened 3, closed 6, and opened 9; and so on. The only doors left open with 10 lockers are 1, 4, and 9. One way to work the problem is to do this with more lockers and look for a pattern in the numbers of the lockers left open; a better way is to look for a REASON why there should be a pattern. What is it that makes one locker end up open and another end up closed? I always emphasize reasons over patterns , because a pattern you see may not be real, and may not continue for larger numbers. I think the first time I solved the problem I saw the pattern very quickly, but had to stop and think in order to convince myself it was real. So now we think about what it takes to leave a locker open: Notice that each time a locker is "touched" it changes from open to closed or vice versa. So in order to end up open, it has to be touched an odd number of times.
- Now, what might make that happen? A key is to realize that the whole problem is about multiples and divisors. Do you see why? That's where the math comes in! If you have any further questions, feel free to write back. Good luck! We never heard back to see whether this was enough to help Michael. We could describe my plan to attack this problem as Play, Pattern, Prove. A little more of a hint … This question from will take us further: Lockers There are lockers in a high school with students. The problem begins with the first student opening all lockers; next the second student closes lockers 2,4,6,8,10 and so on to locker ; the third student changes the state opens lockers closed, closes lockers open on lockers 3,6,9,12,15 and so on; the fourth student changes the state of lockers 4,8,12,16 and so on.
- This goes on until every student has had a turn. How many lockers will be open at the end? What is the formula? I can't figure out the pattern. Kate Note the slightly different way of saying the same thing; using example numbers is helpful. Doctor Bruce carried out parts of my plan, in effect taking Kate partway through the process: I enjoyed thinking about this problem when I first heard it some years ago. The students who come after them are not going to touch lockers , so we can see which ones in that first batch are still open and try to guess the pattern. When we do that, we find that lockers 1, 4, and 9 are open and the others are closed. Now, that isn't much to go on, so maybe you could let the next 10 students go do their thing. Then the first 20 lockers are through being touched, and we find that lockers 1, 4, 9, and 16 are the only ones in the first 20 that are still open.
Python - Locker Problem Expanded - Code Review Stack Exchange
So what is the pattern? Do the numbers 1, 4, 9, 16 look familiar? Now we reverse the experimentation, picking a single locker and thinking about what happens to it, in order to answer my question about what it takes for a locker to end up open: Let's take any old locker, like 48 for example. It gets its state altered once for every student whose number in line is an exact divisor of Here is a chart of what I mean: this Student leaves locker 48 1 open 2 shut 3 open 4 shut 6 open 8 shut 12 open 16 shut 24 open 48 shut Notice that 48 has an even number ten of divisors, namely 1,2,3,4,6,8,12,16,24, So the locker goes open-shut-open-shut Any locker number that has an even number of divisors will end up shut. So the lockers that are open must have an odd number of divisors.- The second student comes in and closes every other locker. The third student comes in and opens every third locker. The pattern continues until all students have done what they're supposed to do. At the end, how many lockers are still open? I need to know what track I have to be on at the very beginning. Doctor Anthony started with a correction, assuming this is meant to be the usual problem: I think you have made a mistake in your description of the problem. In this situation it is easy to see that every locker whose number is a perfect square will be open at the end of the exercise, and all other lockers will be closed. Is that easy to see? Only when you see it the right way. Now all numbers with an even number of factors will end up closed. We conclude that all the lockers whose numbers are perfect squares will be open at the completion of the exercise. But why? We saw this last week, and he briefly explains it here, using prime factors: To show that perfect squares have an odd number of factors we express the number in its prime factors.
- If it is a perfect square the power of each prime factor must be even, e. The number 2 could be chosen 0,1,2 times,i. Note that taking none of 2, 3 or 5 as factors gives the 1 which we require as a factor. Taking all the numbers 2, 3, 5 to their highest power gives the number itself - again one of the factors we require.
Lockers Puzzle - Programmer And Software Interview Questions And Answers
I have often told people that, believe it or not, they could find the answer by searching the Ask Dr. But I prefer to give them a reference to one of the answers in which we gave only hints, because this is a fun problem to discover the answer for yourself. Tiny hints Here is a question from , which asked about two problem, the first of which is our subject: Word Problem Hints 1 There are lockers numbered 1 - Suppose you open all of the lockers, then close every other locker.- Then, for every third locker, you close each opened locker and open each closed locker. You follow the same pattern for every fourth locker, every fifth locker, and so on up to every thousandth locker. Which locker doors will be open when the process is complete? Doctor Jodi gave only a hint: Our office is overflowing with patients at the moment, so let me just try to put a band-aid on these problems for you So every other locker means every locker whose number has what as a factor? And how many times would a switch have to be flipped to be on at the end? Person 1 starts at locker 1 and opens every locker. Person 2 starts at locker 2 and closes every 2nd locker. Person 3 starts at locker 3 and changes every 3rd locker. Person 4 starts at locker 4 and changes every 4th locker.
- Person x starts at locker x and changes every xth locker. I need to figure out which lockers are left open in a row of 25, , and a row of lockers. I have been trying to figure this out for 4 days and my parents can not figure it out either. I don't know what number person x is. My parents say this has nothing to do with math. Can you help? Clearly this is intended to be solved by trying a small example and extending it, rather than by seeing it all at once. There were already several complete solutions in the archive, but I chose to offer some suggestions to help Michael discover a solution himself, rather than just give a link: It has a lot to do with math!
Lisa Winer: Can You Solve The Locker Riddle? | TED Talk Subtitles And Transcript | TED
But I'm not sure whether everyone your age can be expected to figure out the complete answer on his own. You may be expected only to recognize a pattern, but there is a lot of very interesting math if you look deep enough. It sounds like a lot of your confusion is over the 'x' part, so maybe the problem wasn't made fully clear. Usually in this problem it's a classic, by the way , the number of people is the same as the number of lockers in the hallway. So what they mean by 'person x' is all the people from person 1 up to the last person. In other words, if there are 10 lockers there are 10 people, and the pattern continues from person 1 up through person If there are lockers, there are people and each of the goes through the hallway turning lockers that are multiples of their own number.- Does that help? Michael may not yet be fully accustomed to using variables, or may think x must be a specific number to be solved for. If I were you, I would first try "playing" with the problem with a small number of lockers, like 25 so you can see what the whole thing means. Do you follow what I did, and understand how the problem works? The idea is that each person opens or closes only the lockers that are a multiple of his number: 2 changes the multiples of 2, 3 changes the multiples of 3, and so on up to person x, the last one to go through. There are many ways you might write out your work; I chose a way that requires less writing than some, while keeping all the information visible. Each column represents what that person does. The first person opened them all; the second closed 2, 4, 6, 8, and 10; the third opened 3, closed 6, and opened 9; and so on.
No comments:
Post a Comment