This is a classic logic problem for you to think about. You may find it helpful to represent the various scenarios in a visual way.
- A school has 1000 students and 1000 closed lockers numbered 1 to 1000.
- The first student walks along the corridor and opens every locker.
- The second student walks along and closes every second locker.
- The third student walks along and changes the state of every third locker (ie. an open locker is closed and a closed locker is opened) .
- Remaining students walk along, and the kth student change every kth locker, until all 1000 students have walked along the row of lockers.
Questions:
- How many lockers are closed after the third student has passed?
- How many lockers are closed after the fourth student has passed?
- After 1000th student have passed, what is the state of the 100th locker?
- After 100th students have passed, what is the state of the 1000th locker?
- After 1000th students have passed, how many lockers will still be open?
Question 1:
1st student = O O O O O O O O O O O O O O O O O O O O
2nd student = O C O C O C O C O C O C O C O C O C O C O C
3rd student = O C C C O O O C C C O O O C C C O O O C C C
Closed = \(3 \times 166 + 3\) = 501 closed
Question 2:
4th student = O C C O O O O O C C O C O C C O O O O O C C O C
Closed = \(5 \times 83 + 2\) = 417 closed
Question 3:
100th locker = \(2^{2} \times 5^{2}\) = 9 students = odd number = OPEN
Question 4:
1000th locker = \(2^{3}\times 5^{3}\) = 16 students
but not 125th , 200th , 250th , 500th , 1000th students
= \(16\) – \(5\) = 11 students = odd number = OPEN
Question 5:
Closed = even number of factors (eg 6 = 1, 2, 3, 6)
Open = odd number of factors (eg 16 = 1, 2, 4, 8, 16 or any square)
Open = n2 lockers, for integer n = 1 to 31
By Mike Baxter