How many lockers were closed (full question below)?

2015-10-04 1:30 am
There is 500 lockers and 500 people. The first student goes and closes them all. The second student goes and opens one every other (2,4,6,8,etc.). The third student goes and opens every three and if it's open it closes. The fourth student does the same every four and the same for the rest. How many lockers were closed?

I don't want the answer, I just want to know how to solve it. I think I need to use a sigma equation, but I'm not sure.

回答 (1)

2015-10-04 1:40 am
A few things to notice:
- The locker will get touched by each person that is a factor of that locker number. For example, locker #6 will get touched by student #1, #2, #3 and #6.
- If the number of factors is even, the locker will be closed/opened and end up in the open state.
- If the number of factors is odd, the locker will end in the closed state.

One way to figure this out would be to try to see if there is a pattern.
1 -- only touched by student #1 (closed)
2 -- touched by student #1 and #2 (open)
3 -- touched by student #1 and #3 (open)
4 -- touched by student #1, #2 and #4 (closed)
5 -- touched by student #1 and #5 (open)
6 -- touched by student #1, #2, #3 and #6 (open)
7 -- touched by student #1 and #7 (open)
8 -- touched by student #1, #2, #4 and #8 (open)
9 -- touched by student #1, #3 and #9 (closed)
10 -- touched by student #1, #2, #5 and #10 (open)

Do you see the pattern? And do you know why?

Basically most numbers will have factors that pair up to an even number of factors. For example, with locker #12:
1 x 12 = 12
2 x 6 = 12
3 x 4 = 12

So most of the lockers will end up open again.

But the except are the numbers that are perfect squares. For example, take locker #9:
1 x 9 = 9
3 x 3 = 9

The last "pair" of factors is the same number (3). So that leads to an odd number of factors and the locker will end up closed.

The specific lockers that are closed are 1, 4, 9, 16, 25, 36, etc.

So how many lockers would that be? You just need to figure out the last perfect square that is less than 500. The quick way to do that is to take the square root of 500 and round down to the nearest integer.
√500 ≈ 22.36068

So there will be 22 lockers that are closed, namely:
1² = 1
2² = 4
3² = 9
...
21² = 441
22² = 484

Answer:
22 lockers are closed


收錄日期: 2021-04-21 14:30:12
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20151003173024AAL5tYS

檢視 Wayback Machine 備份