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?

See The Solution Submitted by pcbouhid    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Basic solution. | Comment 2 of 4 |
It is clear that he opens 512 lockers on the first trip, 256 on the second trip, ... down to 1 locker on the tenth. In these ten trips, 1023 lockers are opened; the last locker is unopened.

Expressing lockers in binary, it's easily seen the lockers that end in 1 are opened first. (Thus remaining closed lockers all end in 0)

Since the next to last digit alternates every two lockers (as a result of base 2), on the return trip, the lockers he closes must have the same next to last digit. He starts with 1024, which has a 0 as this digit, so all the lockers he close must have 0 as this digit. (Thus remaining lockers end in 10.)

This reasoning can show that the third trip, he closes lockers with 1 as the digit third to left, leaving lockers that end in 010, (leaving lockers that end in 110), and so on.

Edited on December 20, 2008, 11:23 pm
  Posted by Gamer on 2008-12-20 23:17:07

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 (23)
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