All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Just Math
The last locker (Posted on 2008-12-20) Difficulty: 2 of 5
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.)
  Subject Author Date
AnswerK Sengupta2009-01-05 13:38:44
Solutioncomputer solutionCharlie2008-12-21 12:38:01
Basic solution.Gamer2008-12-20 23:17:07
analytical solutionDaniel2008-12-20 22:40:55
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (25)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information