Home > Just Math
The last locker (Posted on 2008-12-20) |
|
There is a line of lockers numbered 1 to 1024, initially all closed.
A man walks down the line, opens 1, then alternately skips and opens each closed locker (so he opens 1, 3, 5, ... , 1023). At the end of the line he walks back, opens the first closed locker, then alternately skips and opens each closed locker (so he opens 1024, skips 1022 and so on).
He continues to walk up and down the line until all the lockers are open.
Which locker is opened last?
|
Submitted by pcbouhid
|
No Rating
|
|
Solution:
|
(Hide)
|
See Danielīs solution here.
See Gamerīs solution here, the same approach as the "official", which is:
Write the labels in binary.
1st pass, open those ending in 1, leaving those ending in 0 still closed.
2nd pass, open those ending in 00, leaving -10 closed.
3rd pass open 010, leaving -110 closed.
4th pass open -1110, leaving -0110 closed.
5th pass, open -00110, leaving -10110.
6th pass open -110110, leaving -010110.
Continuing, we leave the single locker 0101010110 = 342.
|
Comments: (
You must be logged in to post comments.)
|
|
Please log in:
Forums (0)
Newest Problems
Random Problem
FAQ |
About This Site
Site Statistics
New Comments (3)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On
Chatterbox:
|